@trudb/tru-common-lib 0.2.553 → 0.2.554
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.
|
@@ -8953,6 +8953,23 @@ class TruDataGrid {
|
|
|
8953
8953
|
this.api.refreshCells({ force: true });
|
|
8954
8954
|
}
|
|
8955
8955
|
};
|
|
8956
|
+
refsEqual = (left, right) => {
|
|
8957
|
+
return left !== null && left !== undefined &&
|
|
8958
|
+
right !== null && right !== undefined &&
|
|
8959
|
+
left.toString() === right.toString();
|
|
8960
|
+
};
|
|
8961
|
+
confirmRowMembershipBeforeRemoval = (rowNode) => {
|
|
8962
|
+
const ref = rowNode.data?.$entity?.Ref;
|
|
8963
|
+
if (ref === null || ref === undefined)
|
|
8964
|
+
return;
|
|
8965
|
+
this.dataContext.entityAccess().searchByRefWithQuery(this.config.resultConfig.entityType, this.latestSetupQuery, ref).subscribe((results) => {
|
|
8966
|
+
if (results?.length)
|
|
8967
|
+
return;
|
|
8968
|
+
const currentRowNode = rowNode.id === undefined ? null : this.api?.getRowNode(rowNode.id);
|
|
8969
|
+
if (currentRowNode)
|
|
8970
|
+
this.api.applyTransaction({ remove: [currentRowNode.data] });
|
|
8971
|
+
});
|
|
8972
|
+
};
|
|
8956
8973
|
subscribeTo = () => {
|
|
8957
8974
|
this.subs.push(this.appEnvironment.onSaveComplete$.pipe(skip(1)).subscribe(event => {
|
|
8958
8975
|
if (event?.successful)
|
|
@@ -9021,17 +9038,16 @@ class TruDataGrid {
|
|
|
9021
9038
|
dataChange.dataChanges.forEach((change) => {
|
|
9022
9039
|
if (change.changeOperation === 'D') {
|
|
9023
9040
|
this.api.forEachNode((rowNode) => {
|
|
9024
|
-
if (rowNode.data.$entity.Ref
|
|
9025
|
-
rowNodesToRemove.push(
|
|
9026
|
-
}
|
|
9041
|
+
if (this.refsEqual(rowNode.data.$entity.Ref, change.tableRef))
|
|
9042
|
+
rowNodesToRemove.push(rowNode.data);
|
|
9027
9043
|
});
|
|
9028
9044
|
}
|
|
9029
9045
|
if (change.changeOperation === 'U' || change.changeOperation === 'I') {
|
|
9030
9046
|
this.api.forEachNode((rowNode) => {
|
|
9031
|
-
if (rowNode.data.$entity.Ref
|
|
9047
|
+
if (this.refsEqual(rowNode.data.$entity.Ref, change.tableRef)) {
|
|
9032
9048
|
let results = this.dataContext.entityAccess().searchByRefArrayCacheOnly(this.config.resultConfig.entityType, this.latestSetupQuery, [rowNode.data.$entity.Ref]);
|
|
9033
9049
|
if (!results)
|
|
9034
|
-
|
|
9050
|
+
this.confirmRowMembershipBeforeRemoval(rowNode);
|
|
9035
9051
|
}
|
|
9036
9052
|
});
|
|
9037
9053
|
}
|