@trudb/tru-common-lib 0.2.512 → 0.2.517

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.
@@ -2416,6 +2416,7 @@ class TruDesktopViewConfig {
2416
2416
  entityIndex = 0;
2417
2417
  entityRefs = '';
2418
2418
  parentTableRefName = '';
2419
+ parentEntity;
2419
2420
  isDirty = false;
2420
2421
  isEditing = false;
2421
2422
  isInvalid = false;
@@ -4804,12 +4805,14 @@ class TruDetailViewBase {
4804
4805
  customToolbarComponents = [];
4805
4806
  entities = [];
4806
4807
  entity;
4808
+ parentEntity;
4807
4809
  entityType;
4808
4810
  recordLocation = null;
4809
4811
  disableNavigationToPreviousEntity = false;
4810
4812
  disableNavigationToNextEntity = false;
4811
4813
  navigationIndex = 0;
4812
4814
  recordsBeforeRevert = 0;
4815
+ active = false;
4813
4816
  subs = [];
4814
4817
  constructor(dataContext, componentLookup, appEnvironment, textManager, desktopManager, windowEventHandler, desktopViewEventNotifier, util) {
4815
4818
  this.dataContext = dataContext;
@@ -4843,16 +4846,19 @@ class TruDetailViewBase {
4843
4846
  onAddEntity = (newEntity, dataNotification = false) => {
4844
4847
  if (!newEntity)
4845
4848
  newEntity = this.dataContext.entityAccess().add(this.entityType);
4846
- if (!dataNotification && this.view.parentTableRefName)
4847
- newEntity[this.view.parentTableRefName] = this.entity[this.view.parentTableRefName];
4849
+ if (!dataNotification) {
4850
+ if (this.parentEntity && this.view.parentTableRefName)
4851
+ newEntity[this.view.parentTableRefName] = this.parentEntity[this.view.parentTableRefName];
4852
+ else
4853
+ newEntity[this.view.parentTableRefName] = this.entity[this.view.parentTableRefName];
4854
+ }
4848
4855
  if (!dataNotification) {
4849
4856
  this.entities.unshift(newEntity);
4850
4857
  this.navigateTo(0);
4851
4858
  }
4852
4859
  else {
4853
4860
  this.entities.push(newEntity);
4854
- if (this.view.active)
4855
- this.setEntityDisplayValues(this.tableName);
4861
+ this.setEntityDisplayValues(this.tableName);
4856
4862
  }
4857
4863
  };
4858
4864
  onCloneEntity = () => {
@@ -4914,7 +4920,8 @@ class TruDetailViewBase {
4914
4920
  }
4915
4921
  }));
4916
4922
  this.subs.push(this.view.onActive().subscribe((active) => {
4917
- if (active)
4923
+ this.active = active;
4924
+ if (this.active)
4918
4925
  this.setEntityDisplayValues(this.tableName);
4919
4926
  }));
4920
4927
  this.subs.push(fromEvent(document, 'keydown').subscribe((event) => {