@trudb/tru-common-lib 0.2.145 → 0.2.146

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.
@@ -5,7 +5,7 @@ import * as i1$1 from '@angular/common';
5
5
  import { CommonModule, NgIf, NgClass, DatePipe } from '@angular/common';
6
6
  import * as i7 from '@angular/forms';
7
7
  import { FormsModule, FormControl, ReactiveFormsModule, FormGroup, Validators } from '@angular/forms';
8
- import { BehaviorSubject, defer, from, of, Subject, Observable, fromEvent, skip, forkJoin, first, finalize, throwError } from 'rxjs';
8
+ import { BehaviorSubject, defer, from, of, Subject, Observable, fromEvent, skip, forkJoin, first, tap as tap$1, delayWhen, interval, finalize, throwError } from 'rxjs';
9
9
  import * as _ from 'underscore';
10
10
  import ___default from 'underscore';
11
11
  import * as i2 from '@angular/common/http';
@@ -6056,30 +6056,52 @@ class TruDataGridCellRenderer {
6056
6056
  eGui;
6057
6057
  validationContainer;
6058
6058
  params;
6059
- contextMenuPosition = { x: '0px', y: '0px' };
6059
+ contextMenuPosition = { x: 0, y: 0 };
6060
6060
  displayValue = '';
6061
6061
  copyIsDisabled = true;
6062
6062
  pasteIsDisabled = true;
6063
+ menuSubscription;
6063
6064
  constructor(dataContext, dataGridClipboard) {
6064
6065
  this.dataContext = dataContext;
6065
6066
  this.dataGridClipboard = dataGridClipboard;
6066
6067
  }
6068
+ delay(delayInms) {
6069
+ return new Promise((resolve) => {
6070
+ setTimeout(() => {
6071
+ resolve(2);
6072
+ }, delayInms);
6073
+ });
6074
+ }
6067
6075
  onMouseOver = (e) => {
6068
6076
  if (e.target)
6069
6077
  e.target.classList.contains('invalid-flag') ? this.validationContainer.classList.toggle('show') : this.validationContainer.classList.remove('show');
6070
6078
  };
6071
6079
  onRightClick = (event) => {
6072
6080
  event.preventDefault();
6081
+ if (this.params.api.getEditingCells().length > 0)
6082
+ return;
6073
6083
  this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
6074
- let clickedElement = event.target;
6075
- if (clickedElement instanceof Element) {
6076
- if (this.params.api.getEditingCells().length <= 0) {
6077
- this.contextMenuPosition.x = event.clientX + 'px';
6078
- this.contextMenuPosition.y = event.clientY + 'px';
6079
- this.contextMenu.menu?.focusFirstItem('mouse');
6080
- this.contextMenu.openMenu();
6081
- }
6082
- }
6084
+ this.menuSubscription && this.menuSubscription.unsubscribe();
6085
+ this.menuSubscription = of(1)
6086
+ .pipe(tap$1(() => {
6087
+ if (this.contextMenu.menuOpen) {
6088
+ this.contextMenu.closeMenu();
6089
+ }
6090
+ this.contextMenuPosition.x = event.clientX;
6091
+ this.contextMenuPosition.y = event.clientY;
6092
+ }),
6093
+ // delay(this.contextMenu.menuOpen ? 200 : 0),
6094
+ delayWhen((_) => (this.contextMenu.menuOpen ? interval(200) : of(undefined))), tap$1(async () => {
6095
+ this.contextMenu.menu?.focusFirstItem('mouse');
6096
+ this.contextMenu.openMenu();
6097
+ let backdrop;
6098
+ do {
6099
+ await this.delay(100);
6100
+ backdrop = document.querySelector('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing');
6101
+ } while (backdrop === null);
6102
+ backdrop.style.pointerEvents = 'none';
6103
+ }))
6104
+ .subscribe();
6083
6105
  };
6084
6106
  onCopy = (event) => {
6085
6107
  this.dataGridClipboard.copyCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data.$entity);
@@ -6130,7 +6152,7 @@ class TruDataGridCellRenderer {
6130
6152
  <div style="visibility: hidden; position: absolute;"
6131
6153
  [truContextMenuTriggerFor]="truDataGridCellContextMenu">
6132
6154
  </div>
6133
- <mat-menu #truDataGridCellContextMenu="matMenu">
6155
+ <mat-menu #truDataGridCellContextMenu="matMenu" [hasBackdrop]="false">
6134
6156
  <button mat-menu-item (click)="onCopy($event)">
6135
6157
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6136
6158
  <span>Copy</span>
@@ -6156,7 +6178,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
6156
6178
  <div style="visibility: hidden; position: absolute;"
6157
6179
  [truContextMenuTriggerFor]="truDataGridCellContextMenu">
6158
6180
  </div>
6159
- <mat-menu #truDataGridCellContextMenu="matMenu">
6181
+ <mat-menu #truDataGridCellContextMenu="matMenu" [hasBackdrop]="false">
6160
6182
  <button mat-menu-item (click)="onCopy($event)">
6161
6183
  <mat-icon [svgIcon]="'copy-icon'"></mat-icon>
6162
6184
  <span>Copy</span>