@trudb/tru-common-lib 0.2.109 → 0.2.110
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.
|
@@ -5966,7 +5966,32 @@ class TruDataGridClipboard {
|
|
|
5966
5966
|
getCopiedRows = () => {
|
|
5967
5967
|
return this.rowData;
|
|
5968
5968
|
};
|
|
5969
|
-
paste = (
|
|
5969
|
+
paste = (config, selectedRoows) => {
|
|
5970
|
+
if (this.tableName !== config.tableName) {
|
|
5971
|
+
this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
|
|
5972
|
+
return;
|
|
5973
|
+
}
|
|
5974
|
+
if (selectedRoows && selectedRoows.length !== this.rowData.length) {
|
|
5975
|
+
this.uiNotification.error('Clipboard data does not match the number of selected rows: ' + this.rowData.length + ' vs ' + selectedRoows.length);
|
|
5976
|
+
return;
|
|
5977
|
+
}
|
|
5978
|
+
if (this.rowData.length) {
|
|
5979
|
+
this.rowData.forEach((row, index) => {
|
|
5980
|
+
let newEntity = config.resultConfig.entityType.createEntity();
|
|
5981
|
+
let properties = row.entityType.getPropertyNames();
|
|
5982
|
+
properties
|
|
5983
|
+
.filter((propertyName) => {
|
|
5984
|
+
return propertyName !== 'Ref' &&
|
|
5985
|
+
propertyName !== config.resultConfig.entityType.name + 'Ref' &&
|
|
5986
|
+
!this.util.isLowerCase(propertyName.charAt(0));
|
|
5987
|
+
})
|
|
5988
|
+
.forEach((propertyName) => {
|
|
5989
|
+
if (typeof newEntity.setProperty !== 'undefined')
|
|
5990
|
+
newEntity.setProperty(propertyName, row.getProperty(propertyName));
|
|
5991
|
+
});
|
|
5992
|
+
selectedRoows[index].setData(newEntity);
|
|
5993
|
+
});
|
|
5994
|
+
}
|
|
5970
5995
|
};
|
|
5971
5996
|
insertRowsAtTop = (dataContext, config, addEntity) => {
|
|
5972
5997
|
if (this.tableName !== config.tableName) {
|
|
@@ -6041,18 +6066,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6041
6066
|
}
|
|
6042
6067
|
};
|
|
6043
6068
|
onPaste = (event) => {
|
|
6044
|
-
|
|
6045
|
-
copiedRowData.forEach((row) => {
|
|
6046
|
-
let properties = row.entityType.getPropertyNames();
|
|
6047
|
-
properties
|
|
6048
|
-
.filter((propertyName) => {
|
|
6049
|
-
return propertyName !== 'Ref' &&
|
|
6050
|
-
propertyName !== row.entityType.name + 'Ref' &&
|
|
6051
|
-
!this.util.isLowerCase(propertyName.charAt(0));
|
|
6052
|
-
}).forEach((propertyName) => {
|
|
6053
|
-
console.log(propertyName);
|
|
6054
|
-
});
|
|
6055
|
-
});
|
|
6069
|
+
this.dataGridClipboard.paste(this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6056
6070
|
};
|
|
6057
6071
|
onInsertAtTop = (event) => {
|
|
6058
6072
|
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|