@trudb/tru-common-lib 0.2.118 → 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,29 +5954,29 @@ 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
|
|
@@ -5994,6 +5994,7 @@ class TruDataGridClipboard {
|
|
|
5994
5994
|
});
|
|
5995
5995
|
});
|
|
5996
5996
|
});
|
|
5997
|
+
gridApi.refreshCells({ force: true });
|
|
5997
5998
|
}
|
|
5998
5999
|
};
|
|
5999
6000
|
insertRowsAtTop = (dataContext, config, addEntity) => {
|
|
@@ -6001,8 +6002,8 @@ class TruDataGridClipboard {
|
|
|
6001
6002
|
this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
|
|
6002
6003
|
return;
|
|
6003
6004
|
}
|
|
6004
|
-
if (this.
|
|
6005
|
-
this.
|
|
6005
|
+
if (this.copiedRows.length) {
|
|
6006
|
+
this.copiedRows.forEach((row) => {
|
|
6006
6007
|
let newEntity = dataContext.entityAccess().add(config.resultConfig.entityType);
|
|
6007
6008
|
let properties = row.entityType.getPropertyNames();
|
|
6008
6009
|
properties
|
|
@@ -6065,11 +6066,11 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6065
6066
|
let selectedRows = this.params.api.getSelectedRows();
|
|
6066
6067
|
if (selectedRows.length) {
|
|
6067
6068
|
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
6068
|
-
this.dataGridClipboard.
|
|
6069
|
+
this.dataGridClipboard.copy(this.params.context.grid.config.tableName, copiedRowData);
|
|
6069
6070
|
}
|
|
6070
6071
|
};
|
|
6071
6072
|
onPaste = (event) => {
|
|
6072
|
-
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());
|
|
6073
6074
|
};
|
|
6074
6075
|
onInsertAtTop = (event) => {
|
|
6075
6076
|
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|