@trudb/tru-common-lib 0.2.184 → 0.2.186
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.
|
@@ -6328,8 +6328,6 @@ class TruDataGridClipboard {
|
|
|
6328
6328
|
this.uiNotification = uiNotification;
|
|
6329
6329
|
}
|
|
6330
6330
|
formatCellValue = (controlConfig, propertyConfig, entity, value) => {
|
|
6331
|
-
if (value === null || typeof value === 'undefined')
|
|
6332
|
-
return '';
|
|
6333
6331
|
if (propertyConfig.typeName === 'rich-text-unbounded')
|
|
6334
6332
|
return this.util.htmlToPlainText(value);
|
|
6335
6333
|
else if (propertyConfig.typeName === 'foreign-key' || propertyConfig.typeName === 'user-foreign-key')
|
|
@@ -6368,11 +6366,20 @@ class TruDataGridClipboard {
|
|
|
6368
6366
|
params.api.refreshCells({ force: true });
|
|
6369
6367
|
}
|
|
6370
6368
|
};
|
|
6371
|
-
copyRow = async (tableName, columnDefs, copiedRows) => {
|
|
6369
|
+
copyRow = async (tableName, columnDefs, copiedRows, includeHeaders = false) => {
|
|
6372
6370
|
this.tableName = tableName;
|
|
6373
6371
|
this.copiedRows = copiedRows;
|
|
6374
6372
|
if (copiedRows.length) {
|
|
6375
6373
|
let multiRowString = '';
|
|
6374
|
+
if (includeHeaders) {
|
|
6375
|
+
let headerRow = [];
|
|
6376
|
+
columnDefs
|
|
6377
|
+
.forEach((columnDef) => {
|
|
6378
|
+
let propertyName = columnDef.field;
|
|
6379
|
+
headerRow.push(columnDef.headerName || propertyName);
|
|
6380
|
+
});
|
|
6381
|
+
multiRowString += headerRow.join('\t') + '\n';
|
|
6382
|
+
}
|
|
6376
6383
|
this.copiedRows.forEach((copiedRow, index) => {
|
|
6377
6384
|
let rowPropertyValues = [];
|
|
6378
6385
|
let properties = copiedRow.$entity.entityType.getPropertyNames();
|
|
@@ -6498,6 +6505,14 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6498
6505
|
this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, columnDefs, copiedRowData);
|
|
6499
6506
|
}
|
|
6500
6507
|
};
|
|
6508
|
+
onCopyWithHeaders = (event) => {
|
|
6509
|
+
let selectedRows = this.params.api.getSelectedRows();
|
|
6510
|
+
let columnDefs = this.params.api.getColumnDefs();
|
|
6511
|
+
if (selectedRows.length) {
|
|
6512
|
+
let copiedRowData = selectedRows;
|
|
6513
|
+
this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, columnDefs, copiedRowData, true);
|
|
6514
|
+
}
|
|
6515
|
+
};
|
|
6501
6516
|
onPaste = (event) => {
|
|
6502
6517
|
this.dataGridClipboard.pasteRow(this.params.api, this.params.context.grid.config, this.params.api.getSelectedRows());
|
|
6503
6518
|
};
|
|
@@ -6542,6 +6557,10 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6542
6557
|
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6543
6558
|
<span>Copy</span>
|
|
6544
6559
|
</button>
|
|
6560
|
+
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopyWithHeaders($event)">
|
|
6561
|
+
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6562
|
+
<span>Copy (with headers)</span>
|
|
6563
|
+
</button>
|
|
6545
6564
|
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
6546
6565
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6547
6566
|
<span>Paste</span>
|
|
@@ -6572,6 +6591,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
6572
6591
|
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6573
6592
|
<span>Copy</span>
|
|
6574
6593
|
</button>
|
|
6594
|
+
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopyWithHeaders($event)">
|
|
6595
|
+
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6596
|
+
<span>Copy (with headers)</span>
|
|
6597
|
+
</button>
|
|
6575
6598
|
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
6576
6599
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6577
6600
|
<span>Paste</span>
|