@trudb/tru-common-lib 0.2.146 → 0.2.147

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, tap as tap$1, delayWhen, interval, finalize, throwError } from 'rxjs';
8
+ import { BehaviorSubject, defer, from, of, Subject, Observable, fromEvent, skip, forkJoin, first, 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,52 +6056,30 @@ class TruDataGridCellRenderer {
6056
6056
  eGui;
6057
6057
  validationContainer;
6058
6058
  params;
6059
- contextMenuPosition = { x: 0, y: 0 };
6059
+ contextMenuPosition = { x: '0px', y: '0px' };
6060
6060
  displayValue = '';
6061
6061
  copyIsDisabled = true;
6062
6062
  pasteIsDisabled = true;
6063
- menuSubscription;
6064
6063
  constructor(dataContext, dataGridClipboard) {
6065
6064
  this.dataContext = dataContext;
6066
6065
  this.dataGridClipboard = dataGridClipboard;
6067
6066
  }
6068
- delay(delayInms) {
6069
- return new Promise((resolve) => {
6070
- setTimeout(() => {
6071
- resolve(2);
6072
- }, delayInms);
6073
- });
6074
- }
6075
6067
  onMouseOver = (e) => {
6076
6068
  if (e.target)
6077
6069
  e.target.classList.contains('invalid-flag') ? this.validationContainer.classList.toggle('show') : this.validationContainer.classList.remove('show');
6078
6070
  };
6079
6071
  onRightClick = (event) => {
6080
6072
  event.preventDefault();
6081
- if (this.params.api.getEditingCells().length > 0)
6082
- return;
6083
6073
  this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
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();
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
+ }
6105
6083
  };
6106
6084
  onCopy = (event) => {
6107
6085
  this.dataGridClipboard.copyCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data.$entity);