@trudb/tru-common-lib 0.2.148 → 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;
|
|
@@ -6038,6 +6052,9 @@ class TruDataGridClipboard {
|
|
|
6038
6052
|
getCopiedRows = () => {
|
|
6039
6053
|
return this.copiedRows;
|
|
6040
6054
|
};
|
|
6055
|
+
getCopiedCell = () => {
|
|
6056
|
+
return this.copiedCellEntity;
|
|
6057
|
+
};
|
|
6041
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 });
|
|
6042
6059
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
|
|
6043
6060
|
}
|
|
@@ -6071,7 +6088,7 @@ class TruDataGridCellRenderer {
|
|
|
6071
6088
|
};
|
|
6072
6089
|
onRightClick = (event) => {
|
|
6073
6090
|
event.preventDefault();
|
|
6074
|
-
this.pasteIsDisabled = this.dataGridClipboard.
|
|
6091
|
+
this.pasteIsDisabled = this.dataGridClipboard.getCopiedCell() ? false : true;
|
|
6075
6092
|
let clickedElement = event.target;
|
|
6076
6093
|
if (clickedElement instanceof Element) {
|
|
6077
6094
|
if (this.params.api.getEditingCells().length <= 0) {
|
|
@@ -6083,7 +6100,7 @@ class TruDataGridCellRenderer {
|
|
|
6083
6100
|
}
|
|
6084
6101
|
};
|
|
6085
6102
|
onCopy = (event) => {
|
|
6086
|
-
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);
|
|
6087
6104
|
};
|
|
6088
6105
|
onPaste = (event) => {
|
|
6089
6106
|
this.dataGridClipboard.pasteCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data.$entity);
|