@trudb/tru-common-lib 0.2.149 → 0.2.151
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.
|
@@ -5963,20 +5963,34 @@ class TruDataGridClipboard {
|
|
|
5963
5963
|
uiNotification;
|
|
5964
5964
|
tableName = null;
|
|
5965
5965
|
columnName = null;
|
|
5966
|
-
|
|
5966
|
+
copiedCellData = null;
|
|
5967
|
+
copiedCellEntity = null;
|
|
5967
5968
|
copiedRows = [];
|
|
5968
5969
|
constructor(util, uiNotification) {
|
|
5969
5970
|
this.util = util;
|
|
5970
5971
|
this.uiNotification = uiNotification;
|
|
5971
5972
|
}
|
|
5972
|
-
copyCell = (tableName, columnName,
|
|
5973
|
+
copyCell = (tableName, columnName, copiedCellData, copiedCellEntity) => {
|
|
5973
5974
|
this.tableName = tableName;
|
|
5974
5975
|
this.columnName = columnName;
|
|
5975
|
-
this.
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
let
|
|
5976
|
+
this.copiedCellData = copiedCellData;
|
|
5977
|
+
this.copiedCellEntity = copiedCellEntity;
|
|
5978
|
+
};
|
|
5979
|
+
pasteCell = (params, pastedCellData, pastedCell) => {
|
|
5980
|
+
let colDef = params.colDef;
|
|
5981
|
+
let columnName = colDef.field;
|
|
5982
|
+
let copiedCellDataTypeName = this.copiedCellData[params.colDef?.field].property.typeName;
|
|
5983
|
+
let pastedCellDataTypeName = pastedCellData[params.colDef?.field].property.typeName;
|
|
5984
|
+
if (!colDef.editable) {
|
|
5985
|
+
this.uiNotification.error('Cannot paste into a non-editable column: ' + colDef.field);
|
|
5986
|
+
return;
|
|
5987
|
+
}
|
|
5988
|
+
if (copiedCellDataTypeName !== pastedCellDataTypeName) {
|
|
5989
|
+
this.uiNotification.error('Clipboard data type does not match the current cell data type: ' + copiedCellDataTypeName + ' vs ' + pastedCellDataTypeName);
|
|
5990
|
+
return;
|
|
5991
|
+
}
|
|
5992
|
+
else
|
|
5993
|
+
pastedCell.setProperty(columnName, this.copiedCellEntity?.getProperty(columnName));
|
|
5980
5994
|
};
|
|
5981
5995
|
copyRow = (tableName, copiedRows) => {
|
|
5982
5996
|
this.tableName = tableName;
|
|
@@ -6039,7 +6053,7 @@ class TruDataGridClipboard {
|
|
|
6039
6053
|
return this.copiedRows;
|
|
6040
6054
|
};
|
|
6041
6055
|
getCopiedCell = () => {
|
|
6042
|
-
return this.
|
|
6056
|
+
return this.copiedCellEntity;
|
|
6043
6057
|
};
|
|
6044
6058
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [{ token: TruUtil }, { token: TruUiNotification }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6045
6059
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
|
|
@@ -6086,7 +6100,7 @@ class TruDataGridCellRenderer {
|
|
|
6086
6100
|
}
|
|
6087
6101
|
};
|
|
6088
6102
|
onCopy = (event) => {
|
|
6089
|
-
this.dataGridClipboard.copyCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data.$entity);
|
|
6103
|
+
this.dataGridClipboard.copyCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data, this.params.data.$entity);
|
|
6090
6104
|
};
|
|
6091
6105
|
onPaste = (event) => {
|
|
6092
6106
|
this.dataGridClipboard.pasteCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data.$entity);
|