@trudb/tru-common-lib 0.2.219 → 0.2.221
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.
|
@@ -2004,7 +2004,7 @@ class TruDataContext {
|
|
|
2004
2004
|
this.propertyChanged(changeArgs);
|
|
2005
2005
|
this.entityChangedHandler(changeArgs);
|
|
2006
2006
|
}
|
|
2007
|
-
|
|
2007
|
+
if (changeArgs.entityAction === EntityAction.Attach) {
|
|
2008
2008
|
this.entityAdded(changeArgs);
|
|
2009
2009
|
}
|
|
2010
2010
|
});
|
|
@@ -2019,7 +2019,7 @@ class TruDataContext {
|
|
|
2019
2019
|
return this._entityAdded$;
|
|
2020
2020
|
}
|
|
2021
2021
|
entityAdded(changeArgs) {
|
|
2022
|
-
this.
|
|
2022
|
+
this._entityAdded$.next(changeArgs);
|
|
2023
2023
|
}
|
|
2024
2024
|
onDataChanged() {
|
|
2025
2025
|
return this._dataChanged$;
|
|
@@ -7790,7 +7790,25 @@ class TruDataGrid {
|
|
|
7790
7790
|
}
|
|
7791
7791
|
}));
|
|
7792
7792
|
this.subs.push(this.dataContext.onEntityAdded().subscribe((changeArgs) => {
|
|
7793
|
-
|
|
7793
|
+
if (!changeArgs.entity)
|
|
7794
|
+
return;
|
|
7795
|
+
let rowNodesToAdd = [];
|
|
7796
|
+
let entity;
|
|
7797
|
+
if (this.gridType === TruDataGridTypes.DetailManyToMany)
|
|
7798
|
+
entity = this.dataContext.entityAccess().searchByRefCacheOnly(this.config.resultConfig.entityManyToManyType, changeArgs.entity.Ref, true);
|
|
7799
|
+
else
|
|
7800
|
+
entity = this.dataContext.entityAccess().searchByRefCacheOnly(this.config.resultConfig.entityType, changeArgs.entity.Ref, true);
|
|
7801
|
+
if (entity) {
|
|
7802
|
+
let entityAlreadyInGrid = null;
|
|
7803
|
+
this.api?.forEachNodeAfterFilter((rowNode) => {
|
|
7804
|
+
if (rowNode.data.$entity.Ref === changeArgs.entity.Ref)
|
|
7805
|
+
entityAlreadyInGrid = changeArgs.entity;
|
|
7806
|
+
});
|
|
7807
|
+
if (!entityAlreadyInGrid) {
|
|
7808
|
+
rowNodesToAdd.push(this.enhanceRowDataForEntity(entity));
|
|
7809
|
+
this.api.applyTransaction({ remove: rowNodesToAdd });
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7794
7812
|
}));
|
|
7795
7813
|
this.subs.push(fromEvent(document, 'keydown').subscribe((event) => {
|
|
7796
7814
|
if (this.config.view.active && this.config.view.window.active) {
|