@trudb/tru-common-lib 0.2.29 → 0.2.30
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, createComponent, Optional, ViewChildren, signal,
|
|
2
|
+
import { Input, Directive, Injectable, NgModule, Inject, Component, HostListener, InjectionToken, ViewChild, EventEmitter, Output, ViewEncapsulation, Pipe, ViewContainerRef, ChangeDetectionStrategy, createComponent, Optional, ViewChildren, signal, 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,16 +5903,78 @@ 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
|
+
|
|
5906
5926
|
class TruDataGridPkeyCellRenderer {
|
|
5927
|
+
dataGridClipboard;
|
|
5928
|
+
util;
|
|
5929
|
+
contextMenu;
|
|
5930
|
+
params;
|
|
5931
|
+
contextMenuPosition = { x: '0px', y: '0px' };
|
|
5932
|
+
displayValue = '';
|
|
5933
|
+
copyIsDisabled = true;
|
|
5934
|
+
pasteIsDisabled = true;
|
|
5907
5935
|
// private eGui: is an empty element to satisfy the getGui method.
|
|
5908
5936
|
eGui;
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5937
|
+
constructor(dataGridClipboard, util) {
|
|
5938
|
+
this.dataGridClipboard = dataGridClipboard;
|
|
5939
|
+
this.util = util;
|
|
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;
|
|
5912
5973
|
if (params.value < 0)
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5974
|
+
this.displayValue = 'NEW';
|
|
5975
|
+
else
|
|
5976
|
+
this.displayValue = params.value;
|
|
5977
|
+
params.eGridCell.addEventListener('contextmenu', this.onRightClick);
|
|
5916
5978
|
}
|
|
5917
5979
|
getGui() {
|
|
5918
5980
|
return this.eGui;
|
|
@@ -5921,7 +5983,63 @@ class TruDataGridPkeyCellRenderer {
|
|
|
5921
5983
|
return false;
|
|
5922
5984
|
}
|
|
5923
5985
|
destroy() { }
|
|
5924
|
-
}
|
|
5986
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridPkeyCellRenderer, deps: [{ token: TruDataGridClipboard }, { token: TruUtil }], target: i0.ɵɵFactoryTarget.Component });
|
|
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
|
+
}] } });
|
|
5925
6043
|
|
|
5926
6044
|
var TruDataGridTypes;
|
|
5927
6045
|
(function (TruDataGridTypes) {
|
|
@@ -7307,16 +7425,16 @@ class TruDataGrid {
|
|
|
7307
7425
|
else {
|
|
7308
7426
|
if (cellData.event.ctrlKey) {
|
|
7309
7427
|
if (this.rowSelectedOnMousedown)
|
|
7310
|
-
cellData.node.setSelected(false);
|
|
7428
|
+
cellData.node.setSelected(false, false, true);
|
|
7311
7429
|
else
|
|
7312
|
-
cellData.node.setSelected(true);
|
|
7430
|
+
cellData.node.setSelected(true, false, true);
|
|
7313
7431
|
}
|
|
7314
7432
|
else if (cellData.event.shiftKey) {
|
|
7315
7433
|
let focusedId = this.rowFocuedOnMousedown.id;
|
|
7316
7434
|
}
|
|
7317
7435
|
else {
|
|
7318
7436
|
cellData.api.deselectAll();
|
|
7319
|
-
cellData.node.setSelected(true);
|
|
7437
|
+
cellData.node.setSelected(true, false, true);
|
|
7320
7438
|
}
|
|
7321
7439
|
}
|
|
7322
7440
|
};
|