@trudb/tru-common-lib 0.2.156 → 0.2.158

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';
@@ -6077,8 +6077,9 @@ class TruDataGridCellRenderer {
6077
6077
  eGui;
6078
6078
  validationContainer;
6079
6079
  windowClickSubscription;
6080
+ menuSubscription;
6080
6081
  params;
6081
- contextMenuPosition = { x: '0px', y: '0px' };
6082
+ contextMenuPosition = { x: 0, y: 0 };
6082
6083
  displayValue = '';
6083
6084
  copyIsDisabled = true;
6084
6085
  pasteIsDisabled = true;
@@ -6086,6 +6087,13 @@ class TruDataGridCellRenderer {
6086
6087
  this.dataContext = dataContext;
6087
6088
  this.dataGridClipboard = dataGridClipboard;
6088
6089
  }
6090
+ delay(delayInms) {
6091
+ return new Promise((resolve) => {
6092
+ setTimeout(() => {
6093
+ resolve(2);
6094
+ }, delayInms);
6095
+ });
6096
+ }
6089
6097
  onMouseOver = (e) => {
6090
6098
  if (e.target)
6091
6099
  e.target.classList.contains('invalid-flag') ? this.validationContainer.classList.toggle('show') : this.validationContainer.classList.remove('show');
@@ -6093,15 +6101,27 @@ class TruDataGridCellRenderer {
6093
6101
  onRightClick = (event) => {
6094
6102
  event.preventDefault();
6095
6103
  this.pasteIsDisabled = this.dataGridClipboard.getCopiedCell() ? false : true;
6096
- let clickedElement = event.target;
6097
- if (clickedElement instanceof Element) {
6098
- if (this.params.api.getEditingCells().length <= 0) {
6099
- this.contextMenuPosition.x = event.clientX + 'px';
6100
- this.contextMenuPosition.y = event.clientY + 'px';
6101
- this.contextMenu.menu?.focusFirstItem('mouse');
6102
- this.contextMenu.openMenu();
6104
+ this.menuSubscription && this.menuSubscription.unsubscribe();
6105
+ this.menuSubscription = of(1)
6106
+ .pipe(tap$1(() => {
6107
+ if (this.contextMenu.menuOpen) {
6108
+ this.contextMenu.closeMenu();
6103
6109
  }
6104
- }
6110
+ this.contextMenuPosition.x = event.clientX;
6111
+ this.contextMenuPosition.y = event.clientY;
6112
+ }),
6113
+ // delay(this.contextMenu.menuOpen ? 200 : 0),
6114
+ delayWhen((_) => (this.contextMenu.menuOpen ? interval(200) : of(undefined))), tap$1(async () => {
6115
+ this.contextMenu.menu?.focusFirstItem('mouse');
6116
+ this.contextMenu.openMenu();
6117
+ let backdrop;
6118
+ do {
6119
+ await this.delay(100);
6120
+ backdrop = document.querySelector('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing');
6121
+ } while (backdrop === null);
6122
+ backdrop.style.pointerEvents = 'none';
6123
+ }))
6124
+ .subscribe();
6105
6125
  };
6106
6126
  onCopy = (event) => {
6107
6127
  this.dataGridClipboard.copyCell(this.params, this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data, this.params.data.$entity);
@@ -7760,6 +7780,12 @@ class TruDataGrid {
7760
7780
  else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyV') {
7761
7781
  this.dataGridClipboard.pasteRow(this.api, this.config, this.api.getSelectedRows());
7762
7782
  }
7783
+ else if (!params.column.isPinned() && event.ctrlKey && event.code === 'KeyC') {
7784
+ this.dataGridClipboard.copyCell(params, this.config.tableName, params.colDef?.field, params.data, params.data.$entity);
7785
+ }
7786
+ else if (!params.column.isPinned() && event.ctrlKey && event.code === 'KeyV') {
7787
+ this.dataGridClipboard.pasteCell(params, params.data, params.data.$entity);
7788
+ }
7763
7789
  };
7764
7790
  onCellMouseOver(e) {
7765
7791
  let targetElement = e.event.target;