@trudb/tru-common-lib 0.2.105 → 0.2.107

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.
@@ -5380,7 +5380,7 @@ class TruCardColumn {
5380
5380
  }));
5381
5381
  };
5382
5382
  onSearch = (setupQuery) => {
5383
- this.cards = [];
5383
+ this.updateItemsSource([], false);
5384
5384
  this.isBusy = true;
5385
5385
  this.busyMessage = 'Searching for ' + this.childTablePluralLabel + '...';
5386
5386
  let joins = [];
@@ -5951,8 +5951,12 @@ class TruDataGridCellRenderer {
5951
5951
  }
5952
5952
 
5953
5953
  class TruDataGridClipboard {
5954
+ util;
5954
5955
  tableName = null;
5955
5956
  rowData = [];
5957
+ constructor(util) {
5958
+ this.util = util;
5959
+ }
5956
5960
  copiedRows = (tableName, rowData) => {
5957
5961
  this.tableName = tableName;
5958
5962
  this.rowData = rowData;
@@ -5960,7 +5964,28 @@ class TruDataGridClipboard {
5960
5964
  getCopiedRows = () => {
5961
5965
  return this.rowData;
5962
5966
  };
5963
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5967
+ paste = (gridApi, column, rowNode) => {
5968
+ };
5969
+ insertRowsAtTop = (dataContext, config, addEntity) => {
5970
+ if (this.rowData.length) {
5971
+ this.rowData.forEach((row) => {
5972
+ let newEntity = dataContext.entityAccess().add(config.resultConfig.entityType);
5973
+ let properties = row.entityType.getPropertyNames();
5974
+ properties
5975
+ .filter((propertyName) => {
5976
+ return propertyName !== 'Ref' &&
5977
+ propertyName !== config.resultConfig.entityType.name + 'Ref' &&
5978
+ !this.util.isLowerCase(propertyName.charAt(0));
5979
+ })
5980
+ .forEach((propertyName) => {
5981
+ if (typeof newEntity.setProperty !== 'undefined')
5982
+ newEntity.setProperty(propertyName, row.getProperty(propertyName));
5983
+ });
5984
+ addEntity(newEntity, false);
5985
+ });
5986
+ }
5987
+ };
5988
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [{ token: TruUtil }], target: i0.ɵɵFactoryTarget.Injectable });
5964
5989
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
5965
5990
  }
5966
5991
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, decorators: [{
@@ -5968,9 +5993,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
5968
5993
  args: [{
5969
5994
  providedIn: 'root',
5970
5995
  }]
5971
- }] });
5996
+ }], ctorParameters: () => [{ type: TruUtil }] });
5972
5997
 
5973
5998
  class TruDataGridPkeyCellRenderer {
5999
+ dataContext;
5974
6000
  dataGridClipboard;
5975
6001
  util;
5976
6002
  contextMenu;
@@ -5981,7 +6007,8 @@ class TruDataGridPkeyCellRenderer {
5981
6007
  pasteIsDisabled = true;
5982
6008
  // private eGui: is an empty element to satisfy the getGui method.
5983
6009
  eGui;
5984
- constructor(dataGridClipboard, util) {
6010
+ constructor(dataContext, dataGridClipboard, util) {
6011
+ this.dataContext = dataContext;
5985
6012
  this.dataGridClipboard = dataGridClipboard;
5986
6013
  this.util = util;
5987
6014
  }
@@ -6019,6 +6046,10 @@ class TruDataGridPkeyCellRenderer {
6019
6046
  });
6020
6047
  });
6021
6048
  };
6049
+ onInsertAtTop = (event) => {
6050
+ let copiedRowData = this.dataGridClipboard.getCopiedRows();
6051
+ this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
6052
+ };
6022
6053
  agInit(params) {
6023
6054
  this.params = params;
6024
6055
  if (params.value < 0)
@@ -6040,7 +6071,7 @@ class TruDataGridPkeyCellRenderer {
6040
6071
  this.params.eGridCell.removeEventListener('mousedown', this.onMouseDown);
6041
6072
  this.params.eGridCell.removeEventListener('mousedown', this.onMouseUp);
6042
6073
  }
6043
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridPkeyCellRenderer, deps: [{ token: TruDataGridClipboard }, { token: TruUtil }], target: i0.ɵɵFactoryTarget.Component });
6074
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridPkeyCellRenderer, deps: [{ token: TruDataContext }, { token: TruDataGridClipboard }, { token: TruUtil }], target: i0.ɵɵFactoryTarget.Component });
6044
6075
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: TruDataGridPkeyCellRenderer, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "contextMenu", first: true, predicate: MatMenuTrigger, descendants: true }], ngImport: i0, template: `<div (contextmenu)="onRightClick($event)">{{displayValue}}
6045
6076
  <div style="visibility: hidden; position: relative"
6046
6077
  [style.left]="contextMenuPosition.x"
@@ -6056,7 +6087,7 @@ class TruDataGridPkeyCellRenderer {
6056
6087
  <span>Paste</span>
6057
6088
  </button>
6058
6089
  <button mat-menu-item>
6059
- <mat-icon [svgIcon]="'insert-icon'"></mat-icon>
6090
+ <mat-icon [svgIcon]="'insert-icon'" (click)="onInsertAtTop($event)"></mat-icon>
6060
6091
  <span>Insert At Top</span>
6061
6092
  </button>
6062
6093
  </mat-menu>
@@ -6086,12 +6117,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
6086
6117
  <span>Paste</span>
6087
6118
  </button>
6088
6119
  <button mat-menu-item>
6089
- <mat-icon [svgIcon]="'insert-icon'"></mat-icon>
6120
+ <mat-icon [svgIcon]="'insert-icon'" (click)="onInsertAtTop($event)"></mat-icon>
6090
6121
  <span>Insert At Top</span>
6091
6122
  </button>
6092
6123
  </mat-menu>
6093
6124
  </div>`, styles: ["::ng-deep .mat-mdc-menu-item{height:25px!important;min-height:25px!important}::ng-deep .mat-mdc-menu-content mat-icon svg{fill:#949494}\n"] }]
6094
- }], ctorParameters: () => [{ type: TruDataGridClipboard }, { type: TruUtil }], propDecorators: { contextMenu: [{
6125
+ }], ctorParameters: () => [{ type: TruDataContext }, { type: TruDataGridClipboard }, { type: TruUtil }], propDecorators: { contextMenu: [{
6095
6126
  type: ViewChild,
6096
6127
  args: [MatMenuTrigger]
6097
6128
  }] } });
@@ -7100,6 +7131,9 @@ class TruDataGrid {
7100
7131
  rowCount = 'Rows: 0';
7101
7132
  selectedRowCount = 'Selected: 0';
7102
7133
  gridOptions = {
7134
+ context: {
7135
+ grid: this
7136
+ },
7103
7137
  getRowId: (params) => { return params.data.$entity.Ref.toString(); },
7104
7138
  animateRows: false,
7105
7139
  rowSelection: 'multiple',