@trudb/tru-common-lib 0.2.282 → 0.2.284
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.
|
@@ -7649,6 +7649,7 @@ class TruDataGrid {
|
|
|
7649
7649
|
},
|
|
7650
7650
|
animateRows: false,
|
|
7651
7651
|
rowSelection: 'multiple',
|
|
7652
|
+
enableClickSelection: true,
|
|
7652
7653
|
rowStyle: { background: 'white' },
|
|
7653
7654
|
loadingOverlayComponent: TruDataGridLoadingOverlay,
|
|
7654
7655
|
loadingOverlayComponentParams: {
|
|
@@ -7722,6 +7723,32 @@ class TruDataGrid {
|
|
|
7722
7723
|
setNoRowsTemplate = () => {
|
|
7723
7724
|
//this.noRowsTemplate = `<span style="font-size:14px;font-weight:bold;">No data found.</span>`;
|
|
7724
7725
|
};
|
|
7726
|
+
applyRelationships = (newEntity) => {
|
|
7727
|
+
if (this.entity) {
|
|
7728
|
+
newEntity[this.config.parentTableRelationshipRefName] = this.entity[this.config.parentTableRefName];
|
|
7729
|
+
}
|
|
7730
|
+
if (this.gridType === TruDataGridTypes.DetailManyToMany) {
|
|
7731
|
+
//let parentName = this.entity.constructor.name;
|
|
7732
|
+
let unassociatedType = this.config.resultConfig.entityManyToManyType;
|
|
7733
|
+
let ref = this.selectedUnassociatedChoice.value.$;
|
|
7734
|
+
let childToAssociate = this.dataContext.entityAccess().searchByRefCacheOnly(unassociatedType, ref, true);
|
|
7735
|
+
if (childToAssociate) {
|
|
7736
|
+
let enhancedEntity = this.enhanceRowDataForEntity(newEntity);
|
|
7737
|
+
enhancedEntity.$entity[unassociatedType.name + 'Ref'] = childToAssociate[unassociatedType.name + 'Ref'];
|
|
7738
|
+
enhancedEntity.$entity[this.config.parentTableRelationshipRefName] = this.entity[this.config.parentTableRefName];
|
|
7739
|
+
// remove item from the add dropdown control
|
|
7740
|
+
let itemIndex = this.unassociatedChoices.findIndex((choice) => {
|
|
7741
|
+
return choice[unassociatedType.name + 'Ref'] === childToAssociate[unassociatedType.name + 'Ref'];
|
|
7742
|
+
});
|
|
7743
|
+
this.unassociatedChoices.splice(itemIndex, 1);
|
|
7744
|
+
// clear add selection
|
|
7745
|
+
this.selectedUnassociatedChoice = undefined;
|
|
7746
|
+
// add row to grid
|
|
7747
|
+
this.unsavedEntities.push(enhancedEntity);
|
|
7748
|
+
this.api.applyTransaction({ add: [enhancedEntity], addIndex: 0 });
|
|
7749
|
+
}
|
|
7750
|
+
}
|
|
7751
|
+
};
|
|
7725
7752
|
subscribeTo = () => {
|
|
7726
7753
|
this.subs.push(this.appEnvironment.onSaveComplete$.pipe(skip(1)).subscribe(event => {
|
|
7727
7754
|
if (event?.successful)
|
|
@@ -7828,6 +7855,7 @@ class TruDataGrid {
|
|
|
7828
7855
|
if (!entityAlreadyInGrid) {
|
|
7829
7856
|
let enhancedEntity = this.enhanceRowDataForEntity(entity);
|
|
7830
7857
|
if (changeArgs.entity.Ref < 0) {
|
|
7858
|
+
this.applyRelationships(entity);
|
|
7831
7859
|
this.rowData.push(enhancedEntity);
|
|
7832
7860
|
this.api.applyTransaction({ add: [enhancedEntity], addIndex: 0 });
|
|
7833
7861
|
}
|
|
@@ -8103,18 +8131,17 @@ class TruDataGrid {
|
|
|
8103
8131
|
cellData.api.deselectAll();
|
|
8104
8132
|
}
|
|
8105
8133
|
else {
|
|
8106
|
-
if (!cellData.event.shiftKey) {
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
}
|
|
8134
|
+
//if (!cellData.event.shiftKey) {
|
|
8135
|
+
// if (cellData.event.ctrlKey) {
|
|
8136
|
+
// if (this.rowSelectedOnMousedown)
|
|
8137
|
+
// cellData.node.setSelected(false);
|
|
8138
|
+
// else
|
|
8139
|
+
// cellData.node.setSelected(true);
|
|
8140
|
+
// } else {
|
|
8141
|
+
// cellData.api.deselectAll();
|
|
8142
|
+
// cellData.node.setSelected(true);
|
|
8143
|
+
// }
|
|
8144
|
+
//}
|
|
8118
8145
|
}
|
|
8119
8146
|
};
|
|
8120
8147
|
onCellDoubleClicked = (gridConfig) => {
|