@trudb/tru-common-lib 0.2.27 → 0.2.29
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Input, Directive, Injectable, NgModule, Inject, Component, HostListener, InjectionToken, ViewChild, EventEmitter, Output, ViewEncapsulation, Pipe, ViewContainerRef,
|
|
2
|
+
import { Input, Directive, Injectable, NgModule, Inject, Component, HostListener, InjectionToken, ViewChild, EventEmitter, Output, ViewEncapsulation, Pipe, ViewContainerRef, createComponent, Optional, ViewChildren, signal, ChangeDetectionStrategy, QueryList, ContentChildren } from '@angular/core';
|
|
3
3
|
import { EntityAspect, MetadataStore, DataService, EntityManager, EntityQuery, Predicate, FetchStrategy, EntityAction, breeze, EntityState, BinaryPredicate, AndOrPredicate } from 'breeze-client';
|
|
4
4
|
import * as i1$1 from '@angular/common';
|
|
5
5
|
import { CommonModule, NgIf, NgClass, DatePipe } from '@angular/common';
|
|
@@ -5903,78 +5903,16 @@ class TruDataGridCellRenderer {
|
|
|
5903
5903
|
}
|
|
5904
5904
|
}
|
|
5905
5905
|
|
|
5906
|
-
class TruDataGridClipboard {
|
|
5907
|
-
tableName = null;
|
|
5908
|
-
rowData = [];
|
|
5909
|
-
copiedRows = (tableName, rowData) => {
|
|
5910
|
-
this.tableName = tableName;
|
|
5911
|
-
this.rowData = rowData;
|
|
5912
|
-
};
|
|
5913
|
-
getCopiedRows = () => {
|
|
5914
|
-
return this.rowData;
|
|
5915
|
-
};
|
|
5916
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5917
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
|
|
5918
|
-
}
|
|
5919
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, decorators: [{
|
|
5920
|
-
type: Injectable,
|
|
5921
|
-
args: [{
|
|
5922
|
-
providedIn: 'root',
|
|
5923
|
-
}]
|
|
5924
|
-
}] });
|
|
5925
|
-
|
|
5926
5906
|
class TruDataGridPkeyCellRenderer {
|
|
5927
|
-
dataGridClipboard;
|
|
5928
|
-
util;
|
|
5929
|
-
contextMenu;
|
|
5930
|
-
params;
|
|
5931
|
-
contextMenuPosition = { x: '0px', y: '0px' };
|
|
5932
|
-
displayValue = '';
|
|
5933
|
-
copyIsDisabled = true;
|
|
5934
|
-
pasteIsDisabled = true;
|
|
5935
5907
|
// private eGui: is an empty element to satisfy the getGui method.
|
|
5936
5908
|
eGui;
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
}
|
|
5941
|
-
onRightClick = (event) => {
|
|
5942
|
-
event.preventDefault();
|
|
5943
|
-
this.copyIsDisabled = this.params.api.getSelectedRows().length ? false : true;
|
|
5944
|
-
this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
|
|
5945
|
-
this.contextMenuPosition.x = event.pageX + 'px';
|
|
5946
|
-
this.contextMenuPosition.y = (event.pageY - 130) + 'px';
|
|
5947
|
-
this.contextMenu.menu?.focusFirstItem('mouse');
|
|
5948
|
-
this.contextMenu.openMenu();
|
|
5949
|
-
};
|
|
5950
|
-
onCopy = (event) => {
|
|
5951
|
-
let selectedRows = this.params.api.getSelectedRows();
|
|
5952
|
-
if (selectedRows.length) {
|
|
5953
|
-
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
5954
|
-
this.dataGridClipboard.copiedRows('', copiedRowData);
|
|
5955
|
-
}
|
|
5956
|
-
};
|
|
5957
|
-
onPaste = (event) => {
|
|
5958
|
-
let copiedRowData = this.dataGridClipboard.getCopiedRows();
|
|
5959
|
-
copiedRowData.forEach((row) => {
|
|
5960
|
-
let properties = row.entityType.getPropertyNames();
|
|
5961
|
-
properties
|
|
5962
|
-
.filter((propertyName) => {
|
|
5963
|
-
return propertyName !== 'Ref' &&
|
|
5964
|
-
propertyName !== row.entityType.name + 'Ref' &&
|
|
5965
|
-
!this.util.isLowerCase(propertyName.charAt(0));
|
|
5966
|
-
}).forEach((propertyName) => {
|
|
5967
|
-
console.log(propertyName);
|
|
5968
|
-
});
|
|
5969
|
-
});
|
|
5970
|
-
};
|
|
5971
|
-
agInit(params) {
|
|
5972
|
-
this.params = params;
|
|
5909
|
+
init(params) {
|
|
5910
|
+
params.eGridCell.innerHTML = '';
|
|
5911
|
+
let value = params.value;
|
|
5973
5912
|
if (params.value < 0)
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
params.eGridCell.addEventListener('contextmenu', this.onRightClick);
|
|
5913
|
+
value = 'NEW';
|
|
5914
|
+
var content = document.createTextNode(value);
|
|
5915
|
+
params.eGridCell.appendChild(content);
|
|
5978
5916
|
}
|
|
5979
5917
|
getGui() {
|
|
5980
5918
|
return this.eGui;
|
|
@@ -5983,63 +5921,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
5983
5921
|
return false;
|
|
5984
5922
|
}
|
|
5985
5923
|
destroy() { }
|
|
5986
|
-
|
|
5987
|
-
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}}
|
|
5988
|
-
<div style="visibility: hidden; position: fixed"
|
|
5989
|
-
[style.left]="contextMenuPosition.x"
|
|
5990
|
-
[style.top]="contextMenuPosition.y"
|
|
5991
|
-
[matMenuTriggerFor]="truDataGridContextMenu">
|
|
5992
|
-
</div>
|
|
5993
|
-
<mat-menu #truDataGridContextMenu="matMenu">
|
|
5994
|
-
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
|
|
5995
|
-
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
5996
|
-
<span>Copy</span>
|
|
5997
|
-
</button>
|
|
5998
|
-
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
5999
|
-
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6000
|
-
<span>Paste</span>
|
|
6001
|
-
</button>
|
|
6002
|
-
<button mat-menu-item>
|
|
6003
|
-
<mat-icon [svgIcon]="'insert-icon'"></mat-icon>
|
|
6004
|
-
<span>Insert At Top</span>
|
|
6005
|
-
</button>
|
|
6006
|
-
</mat-menu>
|
|
6007
|
-
</div>`, isInline: true, styles: ["::ng-deep .mat-mdc-menu-item{height:25px!important;min-height:25px!important}::ng-deep .mat-mdc-menu-content mat-icon svg{fill:#949494}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i5.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i5.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6008
|
-
}
|
|
6009
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridPkeyCellRenderer, decorators: [{
|
|
6010
|
-
type: Component,
|
|
6011
|
-
args: [{ standalone: true, imports: [
|
|
6012
|
-
NgIf,
|
|
6013
|
-
NgClass,
|
|
6014
|
-
CommonModule,
|
|
6015
|
-
MatIconModule,
|
|
6016
|
-
MatButtonModule,
|
|
6017
|
-
MatMenuModule
|
|
6018
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: `<div (contextmenu)="onRightClick($event)">{{displayValue}}
|
|
6019
|
-
<div style="visibility: hidden; position: fixed"
|
|
6020
|
-
[style.left]="contextMenuPosition.x"
|
|
6021
|
-
[style.top]="contextMenuPosition.y"
|
|
6022
|
-
[matMenuTriggerFor]="truDataGridContextMenu">
|
|
6023
|
-
</div>
|
|
6024
|
-
<mat-menu #truDataGridContextMenu="matMenu">
|
|
6025
|
-
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
|
|
6026
|
-
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
6027
|
-
<span>Copy</span>
|
|
6028
|
-
</button>
|
|
6029
|
-
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
6030
|
-
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6031
|
-
<span>Paste</span>
|
|
6032
|
-
</button>
|
|
6033
|
-
<button mat-menu-item>
|
|
6034
|
-
<mat-icon [svgIcon]="'insert-icon'"></mat-icon>
|
|
6035
|
-
<span>Insert At Top</span>
|
|
6036
|
-
</button>
|
|
6037
|
-
</mat-menu>
|
|
6038
|
-
</div>`, styles: ["::ng-deep .mat-mdc-menu-item{height:25px!important;min-height:25px!important}::ng-deep .mat-mdc-menu-content mat-icon svg{fill:#949494}\n"] }]
|
|
6039
|
-
}], ctorParameters: () => [{ type: TruDataGridClipboard }, { type: TruUtil }], propDecorators: { contextMenu: [{
|
|
6040
|
-
type: ViewChild,
|
|
6041
|
-
args: [MatMenuTrigger]
|
|
6042
|
-
}] } });
|
|
5924
|
+
}
|
|
6043
5925
|
|
|
6044
5926
|
var TruDataGridTypes;
|
|
6045
5927
|
(function (TruDataGridTypes) {
|
|
@@ -6811,7 +6693,7 @@ class TruDataChangeParser {
|
|
|
6811
6693
|
if (this.entityFoundByQuery(change)) {
|
|
6812
6694
|
var entityAlreadyInResults = this.getEntityFromResults(results, change);
|
|
6813
6695
|
if (!entityAlreadyInResults.length && this.isLoaded()) {
|
|
6814
|
-
this.addEntity(entity);
|
|
6696
|
+
this.addEntity(entity, true);
|
|
6815
6697
|
}
|
|
6816
6698
|
reloadResults = true;
|
|
6817
6699
|
}
|
|
@@ -6842,13 +6724,13 @@ class TruDataChangeParser {
|
|
|
6842
6724
|
newEntity[pkeyName] = change.tableRef;
|
|
6843
6725
|
this.applyPropertyChanges(change, newEntity);
|
|
6844
6726
|
if (this.isLoaded()) {
|
|
6845
|
-
this.addEntity(newEntity);
|
|
6727
|
+
this.addEntity(newEntity, true);
|
|
6846
6728
|
reloadResults = true;
|
|
6847
6729
|
}
|
|
6848
6730
|
}
|
|
6849
6731
|
else if (entity === localEntity) {
|
|
6850
6732
|
this.applyPropertyChanges(change, entity);
|
|
6851
|
-
this.addEntity(entity);
|
|
6733
|
+
this.addEntity(entity, true);
|
|
6852
6734
|
reloadResults = true;
|
|
6853
6735
|
}
|
|
6854
6736
|
}
|
|
@@ -6881,7 +6763,7 @@ class TruDataChangeParser {
|
|
|
6881
6763
|
if (entity) {
|
|
6882
6764
|
this.applyPropertyChanges(change, entity);
|
|
6883
6765
|
if (this.entityFoundByQuery(change) && this.isLoaded()) {
|
|
6884
|
-
this.addEntity(newEntity);
|
|
6766
|
+
this.addEntity(newEntity, true);
|
|
6885
6767
|
reloadResults = true;
|
|
6886
6768
|
}
|
|
6887
6769
|
}
|
|
@@ -6898,7 +6780,7 @@ class TruDataChangeParser {
|
|
|
6898
6780
|
newEntity[pkeyName2] = change.tableRef;
|
|
6899
6781
|
this.applyPropertyChanges(change, newEntity);
|
|
6900
6782
|
if (this.entityFoundByQuery(change) && this.isLoaded()) {
|
|
6901
|
-
this.addEntity(newEntity);
|
|
6783
|
+
this.addEntity(newEntity, true);
|
|
6902
6784
|
reloadResults = true;
|
|
6903
6785
|
}
|
|
6904
6786
|
}
|
|
@@ -7289,7 +7171,9 @@ class TruDataGrid {
|
|
|
7289
7171
|
}
|
|
7290
7172
|
return false;
|
|
7291
7173
|
};
|
|
7292
|
-
addEntity = (newEntity) => {
|
|
7174
|
+
addEntity = (newEntity, dataNotification = false) => {
|
|
7175
|
+
if (this.entity && dataNotification)
|
|
7176
|
+
return;
|
|
7293
7177
|
if (this.entity) {
|
|
7294
7178
|
newEntity[this.config.parentTableRelationshipRefName] = this.entity[this.config.parentTableRefName];
|
|
7295
7179
|
}
|