@trudb/tru-common-lib 0.2.185 → 0.2.188
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.
|
@@ -6366,11 +6366,21 @@ class TruDataGridClipboard {
|
|
|
6366
6366
|
params.api.refreshCells({ force: true });
|
|
6367
6367
|
}
|
|
6368
6368
|
};
|
|
6369
|
-
copyRow = async (tableName, columnDefs, copiedRows) => {
|
|
6369
|
+
copyRow = async (tableName, columnDefs, copiedRows, includeHeaders = false) => {
|
|
6370
6370
|
this.tableName = tableName;
|
|
6371
6371
|
this.copiedRows = copiedRows;
|
|
6372
6372
|
if (copiedRows.length) {
|
|
6373
6373
|
let multiRowString = '';
|
|
6374
|
+
if (includeHeaders) {
|
|
6375
|
+
let headerRow = [];
|
|
6376
|
+
columnDefs
|
|
6377
|
+
.forEach((columnDef) => {
|
|
6378
|
+
let propertyName = columnDef.field;
|
|
6379
|
+
if (propertyName && propertyName !== tableName + 'Ref')
|
|
6380
|
+
headerRow.push(columnDef.headerName || propertyName);
|
|
6381
|
+
});
|
|
6382
|
+
multiRowString += headerRow.join('\t') + '\n';
|
|
6383
|
+
}
|
|
6374
6384
|
this.copiedRows.forEach((copiedRow, index) => {
|
|
6375
6385
|
let rowPropertyValues = [];
|
|
6376
6386
|
let properties = copiedRow.$entity.entityType.getPropertyNames();
|
|
@@ -6378,7 +6388,7 @@ class TruDataGridClipboard {
|
|
|
6378
6388
|
.forEach((columnDef) => {
|
|
6379
6389
|
let propertyName = columnDef.field;
|
|
6380
6390
|
let propertyConfig = copiedRow[propertyName]?.property;
|
|
6381
|
-
if (propertyConfig)
|
|
6391
|
+
if (propertyConfig && propertyName && propertyName !== tableName + 'Ref')
|
|
6382
6392
|
rowPropertyValues.push(this.formatCellValue(copiedRow[propertyName], copiedRow[propertyName].property, copiedRow.$entity, copiedRow.$entity.getProperty(propertyName)));
|
|
6383
6393
|
});
|
|
6384
6394
|
multiRowString += rowPropertyValues.join('\t') + '\n';
|
|
@@ -6496,6 +6506,14 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6496
6506
|
this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, columnDefs, copiedRowData);
|
|
6497
6507
|
}
|
|
6498
6508
|
};
|
|
6509
|
+
onCopyWithHeaders = (event) => {
|
|
6510
|
+
let selectedRows = this.params.api.getSelectedRows();
|
|
6511
|
+
let columnDefs = this.params.api.getColumnDefs();
|
|
6512
|
+
if (selectedRows.length) {
|
|
6513
|
+
let copiedRowData = selectedRows;
|
|
6514
|
+
this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, columnDefs, copiedRowData, true);
|
|
6515
|
+
}
|
|
6516
|
+
};
|
|
6499
6517
|
onPaste = (event) => {
|
|
6500
6518
|
this.dataGridClipboard.pasteRow(this.params.api, this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6501
6519
|
};
|
|
@@ -6540,6 +6558,10 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6540
6558
|
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6541
6559
|
<span>Copy</span>
|
|
6542
6560
|
</button>
|
|
6561
|
+
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopyWithHeaders($event)">
|
|
6562
|
+
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6563
|
+
<span>Copy (with headers)</span>
|
|
6564
|
+
</button>
|
|
6543
6565
|
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
6544
6566
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6545
6567
|
<span>Paste</span>
|
|
@@ -6570,6 +6592,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
6570
6592
|
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6571
6593
|
<span>Copy</span>
|
|
6572
6594
|
</button>
|
|
6595
|
+
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopyWithHeaders($event)">
|
|
6596
|
+
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6597
|
+
<span>Copy (with headers)</span>
|
|
6598
|
+
</button>
|
|
6573
6599
|
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
6574
6600
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6575
6601
|
<span>Paste</span>
|