@trudb/tru-common-lib 0.2.117 → 0.2.119
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.
|
@@ -5954,38 +5954,47 @@ class TruDataGridClipboard {
|
|
|
5954
5954
|
util;
|
|
5955
5955
|
uiNotification;
|
|
5956
5956
|
tableName = null;
|
|
5957
|
-
|
|
5957
|
+
copiedRows = [];
|
|
5958
5958
|
constructor(util, uiNotification) {
|
|
5959
5959
|
this.util = util;
|
|
5960
5960
|
this.uiNotification = uiNotification;
|
|
5961
5961
|
}
|
|
5962
|
-
|
|
5962
|
+
copy = (tableName, copiedRows) => {
|
|
5963
5963
|
this.tableName = tableName;
|
|
5964
|
-
this.
|
|
5964
|
+
this.copiedRows = copiedRows;
|
|
5965
5965
|
};
|
|
5966
5966
|
getCopiedRows = () => {
|
|
5967
|
-
return this.
|
|
5967
|
+
return this.copiedRows;
|
|
5968
5968
|
};
|
|
5969
|
-
paste = (config, selectedRows) => {
|
|
5969
|
+
paste = (gridApi, config, selectedRows) => {
|
|
5970
5970
|
if (this.tableName !== config.tableName) {
|
|
5971
5971
|
this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
|
|
5972
5972
|
return;
|
|
5973
5973
|
}
|
|
5974
|
-
if (selectedRows && selectedRows.length !== this.
|
|
5975
|
-
this.uiNotification.error('Clipboard data does not match the number of selected rows: ' + this.
|
|
5974
|
+
if (selectedRows && selectedRows.length !== this.copiedRows.length) {
|
|
5975
|
+
this.uiNotification.error('Clipboard data does not match the number of selected rows: ' + this.copiedRows.length + ' vs ' + selectedRows.length);
|
|
5976
5976
|
return;
|
|
5977
5977
|
}
|
|
5978
|
-
if (this.
|
|
5979
|
-
this.
|
|
5978
|
+
if (this.copiedRows.length) {
|
|
5979
|
+
this.copiedRows.forEach((copiedRow, index) => {
|
|
5980
5980
|
selectedRows.forEach((selectedRow) => {
|
|
5981
5981
|
let properties = copiedRow.entityType.getPropertyNames();
|
|
5982
5982
|
properties
|
|
5983
5983
|
.forEach((propertyName) => {
|
|
5984
|
-
if (typeof selectedRow.$entity.setProperty !== 'undefined' &&
|
|
5984
|
+
if (typeof selectedRow.$entity.setProperty !== 'undefined' &&
|
|
5985
|
+
propertyName !== config.tableName + 'Ref' &&
|
|
5986
|
+
propertyName !== 'Created' &&
|
|
5987
|
+
propertyName !== 'CreatedRef' &&
|
|
5988
|
+
propertyName !== 'Updated' &&
|
|
5989
|
+
propertyName !== 'UpdatedRef' &&
|
|
5990
|
+
propertyName !== 'rowver' &&
|
|
5991
|
+
propertyName !== 'Merge_Data_Set' &&
|
|
5992
|
+
!propertyName.startsWith('o'))
|
|
5985
5993
|
selectedRow.$entity.setProperty(propertyName, copiedRow.getProperty(propertyName));
|
|
5986
5994
|
});
|
|
5987
5995
|
});
|
|
5988
5996
|
});
|
|
5997
|
+
gridApi.refreshCells({ force: true });
|
|
5989
5998
|
}
|
|
5990
5999
|
};
|
|
5991
6000
|
insertRowsAtTop = (dataContext, config, addEntity) => {
|
|
@@ -5993,8 +6002,8 @@ class TruDataGridClipboard {
|
|
|
5993
6002
|
this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
|
|
5994
6003
|
return;
|
|
5995
6004
|
}
|
|
5996
|
-
if (this.
|
|
5997
|
-
this.
|
|
6005
|
+
if (this.copiedRows.length) {
|
|
6006
|
+
this.copiedRows.forEach((row) => {
|
|
5998
6007
|
let newEntity = dataContext.entityAccess().add(config.resultConfig.entityType);
|
|
5999
6008
|
let properties = row.entityType.getPropertyNames();
|
|
6000
6009
|
properties
|
|
@@ -6057,11 +6066,11 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6057
6066
|
let selectedRows = this.params.api.getSelectedRows();
|
|
6058
6067
|
if (selectedRows.length) {
|
|
6059
6068
|
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
6060
|
-
this.dataGridClipboard.
|
|
6069
|
+
this.dataGridClipboard.copy(this.params.context.grid.config.tableName, copiedRowData);
|
|
6061
6070
|
}
|
|
6062
6071
|
};
|
|
6063
6072
|
onPaste = (event) => {
|
|
6064
|
-
this.dataGridClipboard.paste(this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6073
|
+
this.dataGridClipboard.paste(this.params.api, this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6065
6074
|
};
|
|
6066
6075
|
onInsertAtTop = (event) => {
|
|
6067
6076
|
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|