@trudb/tru-common-lib 0.2.154 → 0.2.157
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';
|
|
@@ -5965,21 +5965,23 @@ class TruDataGridClipboard {
|
|
|
5965
5965
|
columnName = null;
|
|
5966
5966
|
copiedCellData = null;
|
|
5967
5967
|
copiedCellEntity = null;
|
|
5968
|
+
copiedCellParams = null;
|
|
5968
5969
|
copiedRows = [];
|
|
5969
5970
|
constructor(util, uiNotification) {
|
|
5970
5971
|
this.util = util;
|
|
5971
5972
|
this.uiNotification = uiNotification;
|
|
5972
5973
|
}
|
|
5973
|
-
copyCell = (tableName, columnName, copiedCellData, copiedCellEntity) => {
|
|
5974
|
+
copyCell = (params, tableName, columnName, copiedCellData, copiedCellEntity) => {
|
|
5974
5975
|
this.tableName = tableName;
|
|
5975
5976
|
this.columnName = columnName;
|
|
5977
|
+
this.copiedCellParams = params;
|
|
5976
5978
|
this.copiedCellData = copiedCellData;
|
|
5977
5979
|
this.copiedCellEntity = copiedCellEntity;
|
|
5978
5980
|
};
|
|
5979
5981
|
pasteCell = (params, pastedCellData, pastedCell) => {
|
|
5980
5982
|
let colDef = params.colDef;
|
|
5981
5983
|
let columnName = colDef.field;
|
|
5982
|
-
let copiedCellDataTypeName = this.copiedCellData[
|
|
5984
|
+
let copiedCellDataTypeName = this.copiedCellData[this.copiedCellParams?.colDef?.field].property.typeName;
|
|
5983
5985
|
let pastedCellDataTypeName = pastedCellData[params.colDef?.field].property.typeName;
|
|
5984
5986
|
if (!colDef.editable) {
|
|
5985
5987
|
this.uiNotification.error('Cannot paste into a non-editable column: ' + colDef.field);
|
|
@@ -6075,8 +6077,9 @@ class TruDataGridCellRenderer {
|
|
|
6075
6077
|
eGui;
|
|
6076
6078
|
validationContainer;
|
|
6077
6079
|
windowClickSubscription;
|
|
6080
|
+
menuSubscription;
|
|
6078
6081
|
params;
|
|
6079
|
-
contextMenuPosition = { x:
|
|
6082
|
+
contextMenuPosition = { x: 0, y: 0 };
|
|
6080
6083
|
displayValue = '';
|
|
6081
6084
|
copyIsDisabled = true;
|
|
6082
6085
|
pasteIsDisabled = true;
|
|
@@ -6084,6 +6087,13 @@ class TruDataGridCellRenderer {
|
|
|
6084
6087
|
this.dataContext = dataContext;
|
|
6085
6088
|
this.dataGridClipboard = dataGridClipboard;
|
|
6086
6089
|
}
|
|
6090
|
+
delay(delayInms) {
|
|
6091
|
+
return new Promise((resolve) => {
|
|
6092
|
+
setTimeout(() => {
|
|
6093
|
+
resolve(2);
|
|
6094
|
+
}, delayInms);
|
|
6095
|
+
});
|
|
6096
|
+
}
|
|
6087
6097
|
onMouseOver = (e) => {
|
|
6088
6098
|
if (e.target)
|
|
6089
6099
|
e.target.classList.contains('invalid-flag') ? this.validationContainer.classList.toggle('show') : this.validationContainer.classList.remove('show');
|
|
@@ -6091,18 +6101,30 @@ class TruDataGridCellRenderer {
|
|
|
6091
6101
|
onRightClick = (event) => {
|
|
6092
6102
|
event.preventDefault();
|
|
6093
6103
|
this.pasteIsDisabled = this.dataGridClipboard.getCopiedCell() ? false : true;
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
this.
|
|
6099
|
-
this.contextMenu.menu?.focusFirstItem('mouse');
|
|
6100
|
-
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();
|
|
6101
6109
|
}
|
|
6102
|
-
|
|
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();
|
|
6103
6125
|
};
|
|
6104
6126
|
onCopy = (event) => {
|
|
6105
|
-
this.dataGridClipboard.copyCell(this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data, this.params.data.$entity);
|
|
6127
|
+
this.dataGridClipboard.copyCell(this.params, this.params.context.grid.config.tableName, this.params.colDef?.field, this.params.data, this.params.data.$entity);
|
|
6106
6128
|
};
|
|
6107
6129
|
onPaste = (event) => {
|
|
6108
6130
|
this.dataGridClipboard.pasteCell(this.params, this.params.data, this.params.data.$entity);
|