@trudb/tru-common-lib 0.2.185 → 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.
@@ -6366,11 +6366,20 @@ 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
+ headerRow.push(columnDef.headerName || propertyName);
6380
+ });
6381
+ multiRowString += headerRow.join('\t') + '\n';
6382
+ }
6374
6383
  this.copiedRows.forEach((copiedRow, index) => {
6375
6384
  let rowPropertyValues = [];
6376
6385
  let properties = copiedRow.$entity.entityType.getPropertyNames();
@@ -6496,6 +6505,14 @@ class TruDataGridPkeyCellRenderer {
6496
6505
  this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, columnDefs, copiedRowData);
6497
6506
  }
6498
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
+ };
6499
6516
  onPaste = (event) => {
6500
6517
  this.dataGridClipboard.pasteRow(this.params.api, this.params.context.grid.config, this.params.api.getSelectedRows());
6501
6518
  };
@@ -6540,6 +6557,10 @@ class TruDataGridPkeyCellRenderer {
6540
6557
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6541
6558
  <span>Copy</span>
6542
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>
6543
6564
  <button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
6544
6565
  <mat-icon [svgIcon]="'paste-icon'"></mat-icon>
6545
6566
  <span>Paste</span>
@@ -6570,6 +6591,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
6570
6591
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6571
6592
  <span>Copy</span>
6572
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>
6573
6598
  <button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
6574
6599
  <mat-icon [svgIcon]="'paste-icon'"></mat-icon>
6575
6600
  <span>Paste</span>