@trudb/tru-common-lib 0.2.109 → 0.2.111

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.
@@ -5966,7 +5966,28 @@ class TruDataGridClipboard {
5966
5966
  getCopiedRows = () => {
5967
5967
  return this.rowData;
5968
5968
  };
5969
- paste = (gridApi, column, rowNode) => {
5969
+ paste = (config, selectedRows) => {
5970
+ if (this.tableName !== config.tableName) {
5971
+ this.uiNotification.error('Clipboard data does not match the current table name: ' + this.tableName + ' vs ' + config.tableName);
5972
+ return;
5973
+ }
5974
+ if (selectedRows && selectedRows.length !== this.rowData.length) {
5975
+ this.uiNotification.error('Clipboard data does not match the number of selected rows: ' + this.rowData.length + ' vs ' + selectedRows.length);
5976
+ return;
5977
+ }
5978
+ if (this.rowData.length) {
5979
+ this.rowData.forEach((copiedRow, index) => {
5980
+ selectedRows.forEach((selectedRow) => {
5981
+ let properties = this.rowData[index].entityType.getPropertyNames();
5982
+ properties
5983
+ .forEach((propertyName) => {
5984
+ if (typeof selectedRow.setProperty !== 'undefined')
5985
+ var test = '';
5986
+ //selectedRow.setProperty(propertyName, this.rowData[index].getProperty(propertyName));
5987
+ });
5988
+ });
5989
+ });
5990
+ }
5970
5991
  };
5971
5992
  insertRowsAtTop = (dataContext, config, addEntity) => {
5972
5993
  if (this.tableName !== config.tableName) {
@@ -6041,18 +6062,7 @@ class TruDataGridPkeyCellRenderer {
6041
6062
  }
6042
6063
  };
6043
6064
  onPaste = (event) => {
6044
- let copiedRowData = this.dataGridClipboard.getCopiedRows();
6045
- copiedRowData.forEach((row) => {
6046
- let properties = row.entityType.getPropertyNames();
6047
- properties
6048
- .filter((propertyName) => {
6049
- return propertyName !== 'Ref' &&
6050
- propertyName !== row.entityType.name + 'Ref' &&
6051
- !this.util.isLowerCase(propertyName.charAt(0));
6052
- }).forEach((propertyName) => {
6053
- console.log(propertyName);
6054
- });
6055
- });
6065
+ this.dataGridClipboard.paste(this.params.context.grid.config, this.params.api.getSelectedRows());
6056
6066
  };
6057
6067
  onInsertAtTop = (event) => {
6058
6068
  this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);