@trudb/tru-common-lib 0.2.178 → 0.2.181

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.
@@ -6368,7 +6368,7 @@ class TruDataGridClipboard {
6368
6368
  params.api.refreshCells({ force: true });
6369
6369
  }
6370
6370
  };
6371
- copyRow = async (tableName, copiedRows) => {
6371
+ copyRow = async (tableName, columnDefs, copiedRows) => {
6372
6372
  this.tableName = tableName;
6373
6373
  this.copiedRows = copiedRows;
6374
6374
  if (copiedRows.length) {
@@ -6376,7 +6376,13 @@ class TruDataGridClipboard {
6376
6376
  this.copiedRows.forEach((copiedRow, index) => {
6377
6377
  let rowPropertyValues = [];
6378
6378
  let properties = copiedRow.$entity.entityType.getPropertyNames();
6379
- properties
6379
+ let propertiesFilteredByColDef = properties.reduce((acc, propertyName) => {
6380
+ if (columnDefs.some(colDef => colDef.field === propertyName)) {
6381
+ acc.push(propertyName);
6382
+ }
6383
+ return acc;
6384
+ }, []);
6385
+ propertiesFilteredByColDef
6380
6386
  .forEach((propertyName) => {
6381
6387
  let propertyConfig = copiedRow[propertyName]?.property;
6382
6388
  if (propertyConfig &&
@@ -6498,7 +6504,7 @@ class TruDataGridPkeyCellRenderer {
6498
6504
  let columnDefs = this.params.api.getColumnDefs();
6499
6505
  if (selectedRows.length) {
6500
6506
  let copiedRowData = selectedRows;
6501
- this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, copiedRowData);
6507
+ this.dataGridClipboard.copyRow(this.params.context.grid.config.tableName, columnDefs, copiedRowData);
6502
6508
  }
6503
6509
  };
6504
6510
  onPaste = (event) => {
@@ -8021,8 +8027,9 @@ class TruDataGrid {
8021
8027
  }
8022
8028
  else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyC') {
8023
8029
  let selectedRows = this.api.getSelectedRows();
8030
+ let columnDefs = this.api.getColumnDefs();
8024
8031
  if (selectedRows.length)
8025
- this.dataGridClipboard.copyRow(this.config.tableName, selectedRows);
8032
+ this.dataGridClipboard.copyRow(this.config.tableName, columnDefs, selectedRows);
8026
8033
  }
8027
8034
  else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyV') {
8028
8035
  this.dataGridClipboard.pasteRow(this.api, this.config, this.api.getSelectedRows());