@trudb/tru-common-lib 0.2.217 → 0.2.219

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.
@@ -1982,6 +1982,7 @@ class TruDataContext {
1982
1982
  entityAccessor;
1983
1983
  uiNotification;
1984
1984
  _propertyChanged$ = new Subject();
1985
+ _entityAdded$ = new Subject();
1985
1986
  _dataChanged$ = new Subject();
1986
1987
  _breezeContext;
1987
1988
  _pendingDeleteEntities = [];
@@ -2003,6 +2004,9 @@ class TruDataContext {
2003
2004
  this.propertyChanged(changeArgs);
2004
2005
  this.entityChangedHandler(changeArgs);
2005
2006
  }
2007
+ else if (changeArgs.entityAction !== EntityAction.Attach) {
2008
+ this.entityAdded(changeArgs);
2009
+ }
2006
2010
  });
2007
2011
  }
2008
2012
  onPropertyChanged() {
@@ -2011,6 +2015,12 @@ class TruDataContext {
2011
2015
  propertyChanged(changeArgs) {
2012
2016
  this._propertyChanged$.next(changeArgs);
2013
2017
  }
2018
+ onEntityAdded() {
2019
+ return this._entityAdded$;
2020
+ }
2021
+ entityAdded(changeArgs) {
2022
+ this._propertyChanged$.next(changeArgs);
2023
+ }
2014
2024
  onDataChanged() {
2015
2025
  return this._dataChanged$;
2016
2026
  }
@@ -7762,7 +7772,6 @@ class TruDataGrid {
7762
7772
  }
7763
7773
  this.subs.push(this.connectionHub.subscribe(this.dataContext, this.config.resultConfig.entityType, this.config.resultConfig.entityType.name, this.addEntity, this.getRowData, () => { return this.latestSetupQuery; }, this.config.resultConfig.expands, [], () => { return true; }).subscribe((dataChange) => {
7764
7774
  let rowNodesToRemove = [];
7765
- let rowNodesToAdd = [];
7766
7775
  dataChange.dataChanges.forEach((change) => {
7767
7776
  if (change.changeOperation === 'D') {
7768
7777
  this.api.forEachNode(function (rowNode) {
@@ -7771,22 +7780,17 @@ class TruDataGrid {
7771
7780
  }
7772
7781
  });
7773
7782
  }
7774
- else if (change.changeOperation === 'I') {
7775
- let entity;
7776
- if (this.gridType === TruDataGridTypes.DetailManyToMany)
7777
- entity = this.dataContext.entityAccess().searchByRefCacheOnly(this.config.resultConfig.entityManyToManyType, change.tableRef, true);
7778
- else
7779
- entity = this.dataContext.entityAccess().searchByRefCacheOnly(this.config.resultConfig.entityType, change.tableRef, true);
7780
- if (entity) {
7781
- rowNodesToAdd.push(this.enhanceRowDataForEntity(entity));
7782
- }
7783
- }
7784
7783
  });
7785
- if (rowNodesToRemove.length)
7784
+ if (rowNodesToRemove.length) {
7786
7785
  this.api.applyTransaction({ remove: rowNodesToRemove });
7787
- if (rowNodesToAdd.length)
7788
- this.api.applyTransaction({ add: rowNodesToRemove });
7789
- this.api.refreshCells({ force: true });
7786
+ this.api.refreshCells({ force: true });
7787
+ }
7788
+ else {
7789
+ this.api.refreshCells({ force: true });
7790
+ }
7791
+ }));
7792
+ this.subs.push(this.dataContext.onEntityAdded().subscribe((changeArgs) => {
7793
+ let test = changeArgs;
7790
7794
  }));
7791
7795
  this.subs.push(fromEvent(document, 'keydown').subscribe((event) => {
7792
7796
  if (this.config.view.active && this.config.view.window.active) {