@trudb/tru-common-lib 0.2.118 → 0.2.120
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,46 +5954,46 @@ 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.
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
});
|
|
5978
|
+
if (this.copiedRows.length) {
|
|
5979
|
+
this.copiedRows.forEach((copiedRow, index) => {
|
|
5980
|
+
let selectedRow = selectedRows[index];
|
|
5981
|
+
let properties = copiedRow.entityType.getPropertyNames();
|
|
5982
|
+
properties
|
|
5983
|
+
.forEach((propertyName) => {
|
|
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'))
|
|
5993
|
+
selectedRow.$entity.setProperty(propertyName, copiedRow.getProperty(propertyName));
|
|
5995
5994
|
});
|
|
5996
5995
|
});
|
|
5996
|
+
gridApi.refreshCells({ force: true });
|
|
5997
5997
|
}
|
|
5998
5998
|
};
|
|
5999
5999
|
insertRowsAtTop = (dataContext, config, addEntity) => {
|
|
@@ -6001,8 +6001,8 @@ class TruDataGridClipboard {
|
|
|
6001
6001
|
this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
|
|
6002
6002
|
return;
|
|
6003
6003
|
}
|
|
6004
|
-
if (this.
|
|
6005
|
-
this.
|
|
6004
|
+
if (this.copiedRows.length) {
|
|
6005
|
+
this.copiedRows.forEach((row) => {
|
|
6006
6006
|
let newEntity = dataContext.entityAccess().add(config.resultConfig.entityType);
|
|
6007
6007
|
let properties = row.entityType.getPropertyNames();
|
|
6008
6008
|
properties
|
|
@@ -6065,11 +6065,11 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6065
6065
|
let selectedRows = this.params.api.getSelectedRows();
|
|
6066
6066
|
if (selectedRows.length) {
|
|
6067
6067
|
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
6068
|
-
this.dataGridClipboard.
|
|
6068
|
+
this.dataGridClipboard.copy(this.params.context.grid.config.tableName, copiedRowData);
|
|
6069
6069
|
}
|
|
6070
6070
|
};
|
|
6071
6071
|
onPaste = (event) => {
|
|
6072
|
-
this.dataGridClipboard.paste(this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6072
|
+
this.dataGridClipboard.paste(this.params.api, this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6073
6073
|
};
|
|
6074
6074
|
onInsertAtTop = (event) => {
|
|
6075
6075
|
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|