@trudb/tru-common-lib 0.2.147 → 0.2.149

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.
@@ -6038,6 +6038,9 @@ class TruDataGridClipboard {
6038
6038
  getCopiedRows = () => {
6039
6039
  return this.copiedRows;
6040
6040
  };
6041
+ getCopiedCell = () => {
6042
+ return this.copiedCell;
6043
+ };
6041
6044
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [{ token: TruUtil }, { token: TruUiNotification }], target: i0.ɵɵFactoryTarget.Injectable });
6042
6045
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
6043
6046
  }
@@ -6055,6 +6058,7 @@ class TruDataGridCellRenderer {
6055
6058
  // private eGui: is an empty element to satisfy the getGui method.
6056
6059
  eGui;
6057
6060
  validationContainer;
6061
+ windowClickSubscription;
6058
6062
  params;
6059
6063
  contextMenuPosition = { x: '0px', y: '0px' };
6060
6064
  displayValue = '';
@@ -6070,7 +6074,7 @@ class TruDataGridCellRenderer {
6070
6074
  };
6071
6075
  onRightClick = (event) => {
6072
6076
  event.preventDefault();
6073
- this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
6077
+ this.pasteIsDisabled = this.dataGridClipboard.getCopiedCell() ? false : true;
6074
6078
  let clickedElement = event.target;
6075
6079
  if (clickedElement instanceof Element) {
6076
6080
  if (this.params.api.getEditingCells().length <= 0) {
@@ -6092,18 +6096,16 @@ class TruDataGridCellRenderer {
6092
6096
  agInit(params) {
6093
6097
  this.params = params;
6094
6098
  this.displayValue = params.value;
6095
- //params.eGridCell.innerHTML = '';
6096
- //let value = params.value;
6097
- //if (params.value === null)
6098
- // value = '';
6099
- //if (params.colDef.cellEditor && params.colDef.cellEditor.name === "StdRichTextList") {
6100
- // var p = document.createElement('div');
6101
- // p.innerHTML = value
6102
- // params.eGridCell.appendChild(p);
6103
- //} else {
6104
- // var content = document.createTextNode(value);
6105
- // params.eGridCell.appendChild(content);
6106
- //}
6099
+ if (params.value === null)
6100
+ this.displayValue = '';
6101
+ if (params.colDef.cellEditor && params.colDef.cellEditor.name === "StdRichTextList") {
6102
+ var p = document.createElement('div');
6103
+ p.innerHTML = params.value;
6104
+ params.eGridCell.appendChild(p);
6105
+ }
6106
+ else {
6107
+ this.displayValue = params.value;
6108
+ }
6107
6109
  this.validationContainer = document.createElement('div');
6108
6110
  this.validationContainer.className = 'dialog-target';
6109
6111
  let validationFlag = document.createElement('span');
@@ -6112,6 +6114,11 @@ class TruDataGridCellRenderer {
6112
6114
  params.eGridCell.appendChild(validationFlag);
6113
6115
  params.eGridCell.addEventListener('mouseover', this.onMouseOver);
6114
6116
  params.eGridCell.addEventListener('contextmenu', this.onRightClick);
6117
+ this.windowClickSubscription = fromEvent(window, 'click').subscribe((_) => {
6118
+ if (this.contextMenu.menuOpen) {
6119
+ this.contextMenu.closeMenu();
6120
+ }
6121
+ });
6115
6122
  Object.assign(params.eGridCell.style, new TruUtil().rulesEval(params.data[params.colDef.field].rules(params.data.$entity)));
6116
6123
  }
6117
6124
  getGui() {
@@ -6122,8 +6129,7 @@ class TruDataGridCellRenderer {
6122
6129
  }
6123
6130
  destroy() {
6124
6131
  document.removeEventListener('mouseover', this.onMouseOver);
6125
- this.contextMenu.closeMenu();
6126
- this.contextMenu.ngOnDestroy();
6132
+ this.windowClickSubscription && this.windowClickSubscription.unsubscribe();
6127
6133
  }
6128
6134
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridCellRenderer, deps: [{ token: TruDataContext }, { token: TruDataGridClipboard }], target: i0.ɵɵFactoryTarget.Component });
6129
6135
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: TruDataGridCellRenderer, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "contextMenu", first: true, predicate: TruContextMenuTrigger, descendants: true }], ngImport: i0, template: `<div>{{displayValue}}
@@ -6176,14 +6182,15 @@ class TruDataGridPkeyCellRenderer {
6176
6182
  dataContext;
6177
6183
  dataGridClipboard;
6178
6184
  contextMenu;
6185
+ // private eGui: is an empty element to satisfy the getGui method.
6186
+ eGui;
6187
+ windowClickSubscription;
6179
6188
  params;
6180
6189
  contextMenuPosition = { x: '0px', y: '0px' };
6181
6190
  displayValue = '';
6182
6191
  copyIsDisabled = true;
6183
6192
  pasteIsDisabled = true;
6184
6193
  insertAtTopIsDisabled = true;
6185
- // private eGui: is an empty element to satisfy the getGui method.
6186
- eGui;
6187
6194
  constructor(dataContext, dataGridClipboard) {
6188
6195
  this.dataContext = dataContext;
6189
6196
  this.dataGridClipboard = dataGridClipboard;
@@ -6224,6 +6231,11 @@ class TruDataGridPkeyCellRenderer {
6224
6231
  params.eGridCell.addEventListener('contextmenu', this.onRightClick);
6225
6232
  params.eGridCell.addEventListener('mousedown', this.onMouseDown);
6226
6233
  params.eGridCell.addEventListener('mousedown', this.onMouseUp);
6234
+ this.windowClickSubscription = fromEvent(window, 'click').subscribe((_) => {
6235
+ if (this.contextMenu.menuOpen) {
6236
+ this.contextMenu.closeMenu();
6237
+ }
6238
+ });
6227
6239
  }
6228
6240
  getGui() {
6229
6241
  return this.eGui;
@@ -6235,14 +6247,15 @@ class TruDataGridPkeyCellRenderer {
6235
6247
  this.params.eGridCell.removeEventListener('contextmenu', this.onRightClick);
6236
6248
  this.params.eGridCell.removeEventListener('mousedown', this.onMouseDown);
6237
6249
  this.params.eGridCell.removeEventListener('mousedown', this.onMouseUp);
6250
+ this.windowClickSubscription && this.windowClickSubscription.unsubscribe();
6238
6251
  }
6239
6252
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridPkeyCellRenderer, deps: [{ token: TruDataContext }, { token: TruDataGridClipboard }], target: i0.ɵɵFactoryTarget.Component });
6240
- 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}}
6253
+ 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>{{displayValue}}
6241
6254
  <div style="visibility: hidden; position: relative"
6242
6255
  [style.left]="contextMenuPosition.x"
6243
6256
  [matMenuTriggerFor]="truDataGridContextMenu">
6244
6257
  </div>
6245
- <mat-menu #truDataGridContextMenu="matMenu">
6258
+ <mat-menu #truDataGridContextMenu="matMenu" [hasBackdrop]="false">
6246
6259
  <button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
6247
6260
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6248
6261
  <span>Copy</span>
@@ -6267,12 +6280,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
6267
6280
  MatIconModule,
6268
6281
  MatButtonModule,
6269
6282
  MatMenuModule
6270
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<div (contextmenu)="onRightClick($event)">{{displayValue}}
6283
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<div>{{displayValue}}
6271
6284
  <div style="visibility: hidden; position: relative"
6272
6285
  [style.left]="contextMenuPosition.x"
6273
6286
  [matMenuTriggerFor]="truDataGridContextMenu">
6274
6287
  </div>
6275
- <mat-menu #truDataGridContextMenu="matMenu">
6288
+ <mat-menu #truDataGridContextMenu="matMenu" [hasBackdrop]="false">
6276
6289
  <button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
6277
6290
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6278
6291
  <span>Copy</span>