@trudb/tru-common-lib 0.2.147 → 0.2.148

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.
@@ -6055,6 +6055,7 @@ class TruDataGridCellRenderer {
6055
6055
  // private eGui: is an empty element to satisfy the getGui method.
6056
6056
  eGui;
6057
6057
  validationContainer;
6058
+ windowClickSubscription;
6058
6059
  params;
6059
6060
  contextMenuPosition = { x: '0px', y: '0px' };
6060
6061
  displayValue = '';
@@ -6092,18 +6093,16 @@ class TruDataGridCellRenderer {
6092
6093
  agInit(params) {
6093
6094
  this.params = params;
6094
6095
  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
- //}
6096
+ if (params.value === null)
6097
+ this.displayValue = '';
6098
+ if (params.colDef.cellEditor && params.colDef.cellEditor.name === "StdRichTextList") {
6099
+ var p = document.createElement('div');
6100
+ p.innerHTML = params.value;
6101
+ params.eGridCell.appendChild(p);
6102
+ }
6103
+ else {
6104
+ this.displayValue = params.value;
6105
+ }
6107
6106
  this.validationContainer = document.createElement('div');
6108
6107
  this.validationContainer.className = 'dialog-target';
6109
6108
  let validationFlag = document.createElement('span');
@@ -6112,6 +6111,11 @@ class TruDataGridCellRenderer {
6112
6111
  params.eGridCell.appendChild(validationFlag);
6113
6112
  params.eGridCell.addEventListener('mouseover', this.onMouseOver);
6114
6113
  params.eGridCell.addEventListener('contextmenu', this.onRightClick);
6114
+ this.windowClickSubscription = fromEvent(window, 'click').subscribe((_) => {
6115
+ if (this.contextMenu.menuOpen) {
6116
+ this.contextMenu.closeMenu();
6117
+ }
6118
+ });
6115
6119
  Object.assign(params.eGridCell.style, new TruUtil().rulesEval(params.data[params.colDef.field].rules(params.data.$entity)));
6116
6120
  }
6117
6121
  getGui() {
@@ -6122,8 +6126,7 @@ class TruDataGridCellRenderer {
6122
6126
  }
6123
6127
  destroy() {
6124
6128
  document.removeEventListener('mouseover', this.onMouseOver);
6125
- this.contextMenu.closeMenu();
6126
- this.contextMenu.ngOnDestroy();
6129
+ this.windowClickSubscription && this.windowClickSubscription.unsubscribe();
6127
6130
  }
6128
6131
  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
6132
  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 +6179,15 @@ class TruDataGridPkeyCellRenderer {
6176
6179
  dataContext;
6177
6180
  dataGridClipboard;
6178
6181
  contextMenu;
6182
+ // private eGui: is an empty element to satisfy the getGui method.
6183
+ eGui;
6184
+ windowClickSubscription;
6179
6185
  params;
6180
6186
  contextMenuPosition = { x: '0px', y: '0px' };
6181
6187
  displayValue = '';
6182
6188
  copyIsDisabled = true;
6183
6189
  pasteIsDisabled = true;
6184
6190
  insertAtTopIsDisabled = true;
6185
- // private eGui: is an empty element to satisfy the getGui method.
6186
- eGui;
6187
6191
  constructor(dataContext, dataGridClipboard) {
6188
6192
  this.dataContext = dataContext;
6189
6193
  this.dataGridClipboard = dataGridClipboard;
@@ -6224,6 +6228,11 @@ class TruDataGridPkeyCellRenderer {
6224
6228
  params.eGridCell.addEventListener('contextmenu', this.onRightClick);
6225
6229
  params.eGridCell.addEventListener('mousedown', this.onMouseDown);
6226
6230
  params.eGridCell.addEventListener('mousedown', this.onMouseUp);
6231
+ this.windowClickSubscription = fromEvent(window, 'click').subscribe((_) => {
6232
+ if (this.contextMenu.menuOpen) {
6233
+ this.contextMenu.closeMenu();
6234
+ }
6235
+ });
6227
6236
  }
6228
6237
  getGui() {
6229
6238
  return this.eGui;
@@ -6235,14 +6244,15 @@ class TruDataGridPkeyCellRenderer {
6235
6244
  this.params.eGridCell.removeEventListener('contextmenu', this.onRightClick);
6236
6245
  this.params.eGridCell.removeEventListener('mousedown', this.onMouseDown);
6237
6246
  this.params.eGridCell.removeEventListener('mousedown', this.onMouseUp);
6247
+ this.windowClickSubscription && this.windowClickSubscription.unsubscribe();
6238
6248
  }
6239
6249
  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}}
6250
+ 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
6251
  <div style="visibility: hidden; position: relative"
6242
6252
  [style.left]="contextMenuPosition.x"
6243
6253
  [matMenuTriggerFor]="truDataGridContextMenu">
6244
6254
  </div>
6245
- <mat-menu #truDataGridContextMenu="matMenu">
6255
+ <mat-menu #truDataGridContextMenu="matMenu" [hasBackdrop]="false">
6246
6256
  <button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
6247
6257
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6248
6258
  <span>Copy</span>
@@ -6267,12 +6277,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
6267
6277
  MatIconModule,
6268
6278
  MatButtonModule,
6269
6279
  MatMenuModule
6270
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<div (contextmenu)="onRightClick($event)">{{displayValue}}
6280
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<div>{{displayValue}}
6271
6281
  <div style="visibility: hidden; position: relative"
6272
6282
  [style.left]="contextMenuPosition.x"
6273
6283
  [matMenuTriggerFor]="truDataGridContextMenu">
6274
6284
  </div>
6275
- <mat-menu #truDataGridContextMenu="matMenu">
6285
+ <mat-menu #truDataGridContextMenu="matMenu" [hasBackdrop]="false">
6276
6286
  <button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
6277
6287
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6278
6288
  <span>Copy</span>