@trudb/tru-common-lib 0.2.107 → 0.2.109
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.
|
@@ -5952,10 +5952,12 @@ class TruDataGridCellRenderer {
|
|
|
5952
5952
|
|
|
5953
5953
|
class TruDataGridClipboard {
|
|
5954
5954
|
util;
|
|
5955
|
+
uiNotification;
|
|
5955
5956
|
tableName = null;
|
|
5956
5957
|
rowData = [];
|
|
5957
|
-
constructor(util) {
|
|
5958
|
+
constructor(util, uiNotification) {
|
|
5958
5959
|
this.util = util;
|
|
5960
|
+
this.uiNotification = uiNotification;
|
|
5959
5961
|
}
|
|
5960
5962
|
copiedRows = (tableName, rowData) => {
|
|
5961
5963
|
this.tableName = tableName;
|
|
@@ -5967,6 +5969,10 @@ class TruDataGridClipboard {
|
|
|
5967
5969
|
paste = (gridApi, column, rowNode) => {
|
|
5968
5970
|
};
|
|
5969
5971
|
insertRowsAtTop = (dataContext, config, addEntity) => {
|
|
5972
|
+
if (this.tableName !== config.tableName) {
|
|
5973
|
+
this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
|
|
5974
|
+
return;
|
|
5975
|
+
}
|
|
5970
5976
|
if (this.rowData.length) {
|
|
5971
5977
|
this.rowData.forEach((row) => {
|
|
5972
5978
|
let newEntity = dataContext.entityAccess().add(config.resultConfig.entityType);
|
|
@@ -5985,7 +5991,7 @@ class TruDataGridClipboard {
|
|
|
5985
5991
|
});
|
|
5986
5992
|
}
|
|
5987
5993
|
};
|
|
5988
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [{ token: TruUtil }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5994
|
+
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 });
|
|
5989
5995
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
|
|
5990
5996
|
}
|
|
5991
5997
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, decorators: [{
|
|
@@ -5993,7 +5999,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
5993
5999
|
args: [{
|
|
5994
6000
|
providedIn: 'root',
|
|
5995
6001
|
}]
|
|
5996
|
-
}], ctorParameters: () => [{ type: TruUtil }] });
|
|
6002
|
+
}], ctorParameters: () => [{ type: TruUtil }, { type: TruUiNotification }] });
|
|
5997
6003
|
|
|
5998
6004
|
class TruDataGridPkeyCellRenderer {
|
|
5999
6005
|
dataContext;
|
|
@@ -6005,6 +6011,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6005
6011
|
displayValue = '';
|
|
6006
6012
|
copyIsDisabled = true;
|
|
6007
6013
|
pasteIsDisabled = true;
|
|
6014
|
+
insertAtTopIsDisabled = true;
|
|
6008
6015
|
// private eGui: is an empty element to satisfy the getGui method.
|
|
6009
6016
|
eGui;
|
|
6010
6017
|
constructor(dataContext, dataGridClipboard, util) {
|
|
@@ -6016,6 +6023,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6016
6023
|
event.preventDefault();
|
|
6017
6024
|
this.copyIsDisabled = this.params.api.getSelectedRows().length ? false : true;
|
|
6018
6025
|
this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
|
|
6026
|
+
this.insertAtTopIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
|
|
6019
6027
|
this.contextMenuPosition.x = event.pageX + 'px';
|
|
6020
6028
|
this.contextMenuPosition.y = (event.pageY) + 'px';
|
|
6021
6029
|
this.contextMenu.menu?.focusFirstItem('mouse');
|
|
@@ -6029,7 +6037,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6029
6037
|
let selectedRows = this.params.api.getSelectedRows();
|
|
6030
6038
|
if (selectedRows.length) {
|
|
6031
6039
|
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
6032
|
-
this.dataGridClipboard.copiedRows(
|
|
6040
|
+
this.dataGridClipboard.copiedRows(this.params.context.grid.config.tableName, copiedRowData);
|
|
6033
6041
|
}
|
|
6034
6042
|
};
|
|
6035
6043
|
onPaste = (event) => {
|
|
@@ -6047,7 +6055,6 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6047
6055
|
});
|
|
6048
6056
|
};
|
|
6049
6057
|
onInsertAtTop = (event) => {
|
|
6050
|
-
let copiedRowData = this.dataGridClipboard.getCopiedRows();
|
|
6051
6058
|
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|
|
6052
6059
|
};
|
|
6053
6060
|
agInit(params) {
|
|
@@ -6086,8 +6093,8 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6086
6093
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6087
6094
|
<span>Paste</span>
|
|
6088
6095
|
</button>
|
|
6089
|
-
<button mat-menu-item>
|
|
6090
|
-
<mat-icon [svgIcon]="'insert-icon'"
|
|
6096
|
+
<button mat-menu-item [disabled]="insertAtTopIsDisabled" (click)="onInsertAtTop($event)">
|
|
6097
|
+
<mat-icon [svgIcon]="'insert-icon'"></mat-icon>
|
|
6091
6098
|
<span>Insert At Top</span>
|
|
6092
6099
|
</button>
|
|
6093
6100
|
</mat-menu>
|
|
@@ -6116,8 +6123,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
6116
6123
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6117
6124
|
<span>Paste</span>
|
|
6118
6125
|
</button>
|
|
6119
|
-
<button mat-menu-item>
|
|
6120
|
-
<mat-icon [svgIcon]="'insert-icon'"
|
|
6126
|
+
<button mat-menu-item [disabled]="insertAtTopIsDisabled" (click)="onInsertAtTop($event)">
|
|
6127
|
+
<mat-icon [svgIcon]="'insert-icon'"></mat-icon>
|
|
6121
6128
|
<span>Insert At Top</span>
|
|
6122
6129
|
</button>
|
|
6123
6130
|
</mat-menu>
|