@memberjunction/ng-user-view-grid 0.9.78 → 0.9.84

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.
@@ -10,7 +10,7 @@ import * as i0 from "@angular/core";
10
10
  export type GridRowClickedEvent = {
11
11
  entityId: number;
12
12
  entityName: string;
13
- recordId: number;
13
+ primaryKeyValue: any;
14
14
  };
15
15
  export type GridRowEditedEvent = {
16
16
  record: BaseEntity;
@@ -518,7 +518,7 @@ export class UserViewGridComponent {
518
518
  this.rowClicked.emit({
519
519
  entityId: this._entityInfo.ID,
520
520
  entityName: this._entityInfo.Name,
521
- recordId: args.dataItem.ID
521
+ primaryKeyValue: args.dataItem[this._entityInfo.PrimaryKey.Name]
522
522
  });
523
523
  if (this._entityInfo.AllowUpdateAPI &&
524
524
  this.EditMode !== "None") {
@@ -530,7 +530,7 @@ export class UserViewGridComponent {
530
530
  }
531
531
  if (!this.InEditMode && this.AutoNavigate) {
532
532
  // tell app router to go to this record
533
- this.router.navigate(['resource', 'record', args.dataItem.ID], { queryParams: { Entity: this._entityInfo.Name } });
533
+ this.router.navigate(['resource', 'record', args.dataItem[this._entityInfo.PrimaryKey.Name]], { queryParams: { Entity: this._entityInfo.Name } });
534
534
  }
535
535
  }
536
536
  });
@@ -573,21 +573,22 @@ export class UserViewGridComponent {
573
573
  // update the data item with the new values - this drives UI refresh while we save the record...
574
574
  Object.assign(dataItem, formGroup.value);
575
575
  const md = new Metadata();
576
+ const pkey = this._entityInfo.PrimaryKey.Name;
576
577
  let record;
577
578
  let bSaved = false;
578
579
  if (this.EditMode === "Save") {
579
580
  record = yield md.GetEntityObject(this._entityInfo.Name);
580
- yield record.Load(dataItem.ID);
581
+ yield record.Load(dataItem[pkey]);
581
582
  record.SetMany(formGroup.value);
582
583
  bSaved = yield record.Save();
583
584
  if (!bSaved)
584
- this.CreateSimpleNotification("Error saving record: " + record.ID, 'error', 5000);
585
+ this.CreateSimpleNotification("Error saving record: " + record.Get(pkey), 'error', 5000);
585
586
  }
586
587
  else {
587
- record = (_a = this._pendingRecords.find((r) => r.record.ID === dataItem.ID)) === null || _a === void 0 ? void 0 : _a.record;
588
+ record = (_a = this._pendingRecords.find((r) => r.record.Get(pkey) === dataItem[pkey])) === null || _a === void 0 ? void 0 : _a.record;
588
589
  if (!record) { // haven't edited this one before
589
590
  record = yield md.GetEntityObject(this._viewEntity.Get('Entity'));
590
- yield record.Load(dataItem.ID);
591
+ yield record.Load(dataItem[pkey]);
591
592
  this._pendingRecords.push({ record,
592
593
  row: args.rowIndex,
593
594
  dataItem }); // don't save - put the changed record on a queue for saving later by our container
@@ -816,10 +817,11 @@ export class UserViewGridComponent {
816
817
  if (event === 'yes') {
817
818
  if (this._entityInfo && this.recordCompareComponent) {
818
819
  const md = new Metadata();
820
+ const pkey = this._entityInfo.PrimaryKey.Name;
819
821
  const result = yield md.MergeRecords({
820
822
  EntityName: this._entityInfo.Name,
821
- RecordsToMerge: this.recordsToCompare.map((r) => r.ID).filter((id) => { var _a; return id !== ((_a = this.recordCompareComponent) === null || _a === void 0 ? void 0 : _a.selectedRecordId); }),
822
- SurvivingRecordID: this.recordCompareComponent.selectedRecordId,
823
+ RecordsToMerge: this.recordsToCompare.map((r) => r.Get(pkey)).filter((pkeyVal) => { var _a; return pkeyVal !== ((_a = this.recordCompareComponent) === null || _a === void 0 ? void 0 : _a.selectedRecordPKeyVal); }),
824
+ SurvivingRecordPrimaryKeyValue: this.recordCompareComponent.selectedRecordPKeyVal,
823
825
  FieldMap: this.recordCompareComponent.fieldMap.map((fm) => {
824
826
  return {
825
827
  FieldName: fm.fieldName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-user-view-grid",
3
- "version": "0.9.78",
3
+ "version": "0.9.84",
4
4
  "description": "MemberJunction: Angular Grid to display dynamic and saved user views for any entity in MemberJunction.",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -26,11 +26,11 @@
26
26
  "@progress/kendo-angular-grid": "^12.1.0"
27
27
  },
28
28
  "dependencies": {
29
- "@memberjunction/core-entities": "^0.9.71",
30
- "@memberjunction/global": "^0.9.102",
31
- "@memberjunction/core": "^0.9.99",
32
- "@memberjunction/ng-compare-records": "^0.9.99",
33
- "@memberjunction/ng-container-directives": "^0.9.74",
29
+ "@memberjunction/core-entities": "^0.9.75",
30
+ "@memberjunction/global": "^0.9.104",
31
+ "@memberjunction/core": "^0.9.103",
32
+ "@memberjunction/ng-compare-records": "^0.9.105",
33
+ "@memberjunction/ng-container-directives": "^0.9.80",
34
34
  "tslib": "^2.3.0"
35
35
  },
36
36
  "sideEffects": false