@trudb/tru-common-lib 0.2.126 → 0.2.128
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 = '';
|
|
5924
|
+
};
|
|
5925
|
+
copyRow = (tableName, copiedRows) => {
|
|
5926
|
+
this.tableName = tableName;
|
|
5927
|
+
this.copiedRows = copiedRows;
|
|
5920
5928
|
};
|
|
5921
|
-
|
|
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,14 +6016,20 @@ 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 = event.pageX + '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
6035
|
}
|
|
@@ -6052,7 +6069,7 @@ class TruDataGridCellRenderer {
|
|
|
6052
6069
|
}
|
|
6053
6070
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridCellRenderer, deps: [{ token: TruDataContext }, { token: TruDataGridClipboard }], target: i0.ɵɵFactoryTarget.Component });
|
|
6054
6071
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: TruDataGridCellRenderer, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "contextMenu", first: true, predicate: MatMenuTrigger, descendants: true }], ngImport: i0, template: `<div (contextmenu)="onRightClick($event)">{{displayValue}}
|
|
6055
|
-
<div style="visibility: hidden; position:
|
|
6072
|
+
<div style="visibility: hidden; position: absolute; left: 0"
|
|
6056
6073
|
[style.left]="contextMenuPosition.x"
|
|
6057
6074
|
[matMenuTriggerFor]="truDataGridContextMenu">
|
|
6058
6075
|
</div>
|
|
@@ -6078,7 +6095,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
6078
6095
|
MatButtonModule,
|
|
6079
6096
|
MatMenuModule
|
|
6080
6097
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: `<div (contextmenu)="onRightClick($event)">{{displayValue}}
|
|
6081
|
-
<div style="visibility: hidden; position:
|
|
6098
|
+
<div style="visibility: hidden; position: absolute; left: 0"
|
|
6082
6099
|
[style.left]="contextMenuPosition.x"
|
|
6083
6100
|
[matMenuTriggerFor]="truDataGridContextMenu">
|
|
6084
6101
|
</div>
|
|
@@ -6132,11 +6149,11 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6132
6149
|
let selectedRows = this.params.api.getSelectedRows();
|
|
6133
6150
|
if (selectedRows.length) {
|
|
6134
6151
|
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
6135
|
-
this.dataGridClipboard.
|
|
6152
|
+
this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, copiedRowData);
|
|
6136
6153
|
}
|
|
6137
6154
|
};
|
|
6138
6155
|
onPaste = (event) => {
|
|
6139
|
-
this.dataGridClipboard.
|
|
6156
|
+
this.dataGridClipboard.pasteRow(this.params.api, this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6140
6157
|
};
|
|
6141
6158
|
onInsertAtTop = (event) => {
|
|
6142
6159
|
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|
|
@@ -7650,10 +7667,10 @@ class TruDataGrid {
|
|
|
7650
7667
|
else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyC') {
|
|
7651
7668
|
let selectedRows = this.api.getSelectedRows();
|
|
7652
7669
|
if (selectedRows.length)
|
|
7653
|
-
this.dataGridClipboard.
|
|
7670
|
+
this.dataGridClipboard.copyRow(this.config.tableName, selectedRows.map((row) => row.$entity));
|
|
7654
7671
|
}
|
|
7655
7672
|
else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyV') {
|
|
7656
|
-
this.dataGridClipboard.
|
|
7673
|
+
this.dataGridClipboard.pasteRow(this.api, this.config, this.api.getSelectedRows());
|
|
7657
7674
|
}
|
|
7658
7675
|
};
|
|
7659
7676
|
onCellMouseOver(e) {
|