@trudb/tru-common-lib 0.2.125 → 0.2.127
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.
|
@@ -5906,19 +5906,27 @@ class TruDataGridClipboard {
|
|
|
5906
5906
|
util;
|
|
5907
5907
|
uiNotification;
|
|
5908
5908
|
tableName = null;
|
|
5909
|
+
columnName = null;
|
|
5910
|
+
copiedCell = null;
|
|
5909
5911
|
copiedRows = [];
|
|
5910
5912
|
constructor(util, uiNotification) {
|
|
5911
5913
|
this.util = util;
|
|
5912
5914
|
this.uiNotification = uiNotification;
|
|
5913
5915
|
}
|
|
5914
|
-
|
|
5916
|
+
copyCell = (tableName, columnName, copiedCell) => {
|
|
5915
5917
|
this.tableName = tableName;
|
|
5916
|
-
this.
|
|
5918
|
+
this.columnName = columnName;
|
|
5919
|
+
this.copiedCell = copiedCell;
|
|
5917
5920
|
};
|
|
5918
|
-
|
|
5919
|
-
|
|
5921
|
+
pasteCell = (tableName, columnName, pastedCell) => {
|
|
5922
|
+
//pastedCell.setProperty(this.columnName, this.copiedCell?.getProperty(this.columnName));
|
|
5923
|
+
let test = '';
|
|
5920
5924
|
};
|
|
5921
|
-
|
|
5925
|
+
copyRow = (tableName, copiedRows) => {
|
|
5926
|
+
this.tableName = tableName;
|
|
5927
|
+
this.copiedRows = copiedRows;
|
|
5928
|
+
};
|
|
5929
|
+
pasteRow = (gridApi, config, selectedRows) => {
|
|
5922
5930
|
if (this.tableName !== config.tableName) {
|
|
5923
5931
|
this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
|
|
5924
5932
|
return;
|
|
@@ -5971,6 +5979,9 @@ class TruDataGridClipboard {
|
|
|
5971
5979
|
});
|
|
5972
5980
|
}
|
|
5973
5981
|
};
|
|
5982
|
+
getCopiedRows = () => {
|
|
5983
|
+
return this.copiedRows;
|
|
5984
|
+
};
|
|
5974
5985
|
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 });
|
|
5975
5986
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
|
|
5976
5987
|
}
|
|
@@ -6005,29 +6016,38 @@ class TruDataGridCellRenderer {
|
|
|
6005
6016
|
event.preventDefault();
|
|
6006
6017
|
this.copyIsDisabled = this.params.api.getSelectedRows().length ? false : true;
|
|
6007
6018
|
this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6019
|
+
let clickedElement = event.target;
|
|
6020
|
+
if (clickedElement instanceof Element) {
|
|
6021
|
+
let rect = clickedElement.getBoundingClientRect();
|
|
6022
|
+
this.contextMenuPosition.x = rect.x + 'px';
|
|
6023
|
+
this.contextMenuPosition.y = (event.pageY) + 'px';
|
|
6024
|
+
this.contextMenu.menu?.focusFirstItem('mouse');
|
|
6025
|
+
this.contextMenu.openMenu();
|
|
6026
|
+
}
|
|
6012
6027
|
};
|
|
6013
6028
|
onCopy = (event) => {
|
|
6029
|
+
this.dataGridClipboard.copyCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data.$entity);
|
|
6014
6030
|
};
|
|
6015
6031
|
onPaste = (event) => {
|
|
6032
|
+
this.dataGridClipboard.pasteCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data.$entity);
|
|
6016
6033
|
};
|
|
6017
6034
|
init(params) {
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
}
|
|
6035
|
+
}
|
|
6036
|
+
agInit(params) {
|
|
6037
|
+
this.params = params;
|
|
6038
|
+
this.displayValue = params.value;
|
|
6039
|
+
//params.eGridCell.innerHTML = '';
|
|
6040
|
+
//let value = params.value;
|
|
6041
|
+
//if (params.value === null)
|
|
6042
|
+
// value = '';
|
|
6043
|
+
//if (params.colDef.cellEditor && params.colDef.cellEditor.name === "StdRichTextList") {
|
|
6044
|
+
// var p = document.createElement('div');
|
|
6045
|
+
// p.innerHTML = value
|
|
6046
|
+
// params.eGridCell.appendChild(p);
|
|
6047
|
+
//} else {
|
|
6048
|
+
// var content = document.createTextNode(value);
|
|
6049
|
+
// params.eGridCell.appendChild(content);
|
|
6050
|
+
//}
|
|
6031
6051
|
this.validationContainer = document.createElement('div');
|
|
6032
6052
|
this.validationContainer.className = 'dialog-target';
|
|
6033
6053
|
let validationFlag = document.createElement('span');
|
|
@@ -6038,10 +6058,6 @@ class TruDataGridCellRenderer {
|
|
|
6038
6058
|
params.eGridCell.addEventListener('contextmenu', this.onRightClick);
|
|
6039
6059
|
Object.assign(params.eGridCell.style, new TruUtil().rulesEval(params.data[params.colDef.field].rules(params.data.$entity)));
|
|
6040
6060
|
}
|
|
6041
|
-
agInit(params) {
|
|
6042
|
-
this.params = params;
|
|
6043
|
-
this.displayValue = params.value;
|
|
6044
|
-
}
|
|
6045
6061
|
getGui() {
|
|
6046
6062
|
return this.eGui;
|
|
6047
6063
|
}
|
|
@@ -6133,11 +6149,11 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6133
6149
|
let selectedRows = this.params.api.getSelectedRows();
|
|
6134
6150
|
if (selectedRows.length) {
|
|
6135
6151
|
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
6136
|
-
this.dataGridClipboard.
|
|
6152
|
+
this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, copiedRowData);
|
|
6137
6153
|
}
|
|
6138
6154
|
};
|
|
6139
6155
|
onPaste = (event) => {
|
|
6140
|
-
this.dataGridClipboard.
|
|
6156
|
+
this.dataGridClipboard.pasteRow(this.params.api, this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6141
6157
|
};
|
|
6142
6158
|
onInsertAtTop = (event) => {
|
|
6143
6159
|
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|
|
@@ -7651,10 +7667,10 @@ class TruDataGrid {
|
|
|
7651
7667
|
else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyC') {
|
|
7652
7668
|
let selectedRows = this.api.getSelectedRows();
|
|
7653
7669
|
if (selectedRows.length)
|
|
7654
|
-
this.dataGridClipboard.
|
|
7670
|
+
this.dataGridClipboard.copyRow(this.config.tableName, selectedRows.map((row) => row.$entity));
|
|
7655
7671
|
}
|
|
7656
7672
|
else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyV') {
|
|
7657
|
-
this.dataGridClipboard.
|
|
7673
|
+
this.dataGridClipboard.pasteRow(this.api, this.config, this.api.getSelectedRows());
|
|
7658
7674
|
}
|
|
7659
7675
|
};
|
|
7660
7676
|
onCellMouseOver(e) {
|