@trudb/tru-common-lib 0.2.13 → 0.2.15
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.
- package/fesm2022/trudb-tru-common-lib.mjs +78 -26
- package/fesm2022/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/components/card-column/tru-card-column.d.ts +1 -1
- package/lib/components/data-grid/classes/tru-data-grid-pkey-cell-renderer.d.ts +9 -0
- package/lib/components/data-grid/services/tru-data-grid-clipboard.d.ts +10 -0
- package/package.json +1 -1
|
@@ -5477,7 +5477,7 @@ class TruCardColumn {
|
|
|
5477
5477
|
elements[0].parentNode?.removeChild(elements[0]);
|
|
5478
5478
|
}
|
|
5479
5479
|
};
|
|
5480
|
-
drop = (e, card) => {
|
|
5480
|
+
drop = async (e, card) => {
|
|
5481
5481
|
e.stopPropagation();
|
|
5482
5482
|
for (var i = this.selectedCards.length - 1; i >= 0; --i) {
|
|
5483
5483
|
let index = card.column.cards.indexOf(this.selectedCards[i]);
|
|
@@ -5505,24 +5505,25 @@ class TruCardColumn {
|
|
|
5505
5505
|
this.selectedCards.pop();
|
|
5506
5506
|
}
|
|
5507
5507
|
;
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5508
|
+
let savePromise = this.dataContext.saveWithoutNotification();
|
|
5509
|
+
if (savePromise) {
|
|
5510
|
+
this.portal.nativeElement.classList.add('tru-card-portal-disabled');
|
|
5511
|
+
await savePromise.then(() => {
|
|
5512
|
+
this.portal.nativeElement.classList.remove('tru-card-portal-disabled');
|
|
5513
|
+
}).catch(() => {
|
|
5514
|
+
e.preventDefault();
|
|
5515
|
+
var columnElement = this.portal.nativeElement.querySelectorAll('.tru-card-portal-columns')[0];
|
|
5516
|
+
localStorage.setItem('scroll_position' + this.uniqueId, columnElement.scrollLeft);
|
|
5517
|
+
this.dataContext.revert();
|
|
5518
|
+
this.portal.nativeElement.classList.remove('tru-card-portal-disabled');
|
|
5519
|
+
});
|
|
5520
|
+
}
|
|
5521
|
+
else {
|
|
5522
|
+
e.preventDefault();
|
|
5523
|
+
var columnElement = this.portal.nativeElement.querySelectorAll('.tru-card-portal-columns')[0];
|
|
5524
|
+
localStorage.setItem('scroll_position' + this.uniqueId, columnElement.scrollLeft);
|
|
5525
|
+
this.dataContext.revert();
|
|
5526
|
+
}
|
|
5526
5527
|
}
|
|
5527
5528
|
return true;
|
|
5528
5529
|
};
|
|
@@ -5900,20 +5901,71 @@ class TruDataGridCellRenderer {
|
|
|
5900
5901
|
}
|
|
5901
5902
|
}
|
|
5902
5903
|
|
|
5904
|
+
class TruDataGridClipboard {
|
|
5905
|
+
tableName = null;
|
|
5906
|
+
rowData = [];
|
|
5907
|
+
copiedRows = (tableName, rowData) => {
|
|
5908
|
+
this.tableName = tableName;
|
|
5909
|
+
this.rowData = rowData;
|
|
5910
|
+
};
|
|
5911
|
+
getCopiedRows = () => {
|
|
5912
|
+
return this.rowData;
|
|
5913
|
+
};
|
|
5914
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5915
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
|
|
5916
|
+
}
|
|
5917
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, decorators: [{
|
|
5918
|
+
type: Injectable,
|
|
5919
|
+
args: [{
|
|
5920
|
+
providedIn: 'root',
|
|
5921
|
+
}]
|
|
5922
|
+
}] });
|
|
5923
|
+
|
|
5903
5924
|
class TruDataGridPkeyCellRenderer {
|
|
5925
|
+
dataGridClipboard;
|
|
5926
|
+
util;
|
|
5904
5927
|
contextMenu;
|
|
5905
5928
|
params;
|
|
5906
5929
|
contextMenuPosition = { x: '0px', y: '0px' };
|
|
5907
5930
|
displayValue = '';
|
|
5931
|
+
copyIsDisabled = true;
|
|
5932
|
+
pasteIsDisabled = true;
|
|
5908
5933
|
// private eGui: is an empty element to satisfy the getGui method.
|
|
5909
5934
|
eGui;
|
|
5935
|
+
constructor(dataGridClipboard, util) {
|
|
5936
|
+
this.dataGridClipboard = dataGridClipboard;
|
|
5937
|
+
this.util = util;
|
|
5938
|
+
}
|
|
5910
5939
|
onRightClick = (event) => {
|
|
5911
5940
|
event.preventDefault();
|
|
5941
|
+
this.copyIsDisabled = this.params.api.getSelectedRows().length ? false : true;
|
|
5942
|
+
this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
|
|
5912
5943
|
this.contextMenuPosition.x = event.pageX + 'px';
|
|
5913
|
-
this.contextMenuPosition.y = event.pageY + 'px';
|
|
5944
|
+
this.contextMenuPosition.y = (event.pageY - 130) + 'px';
|
|
5914
5945
|
this.contextMenu.menu?.focusFirstItem('mouse');
|
|
5915
5946
|
this.contextMenu.openMenu();
|
|
5916
5947
|
};
|
|
5948
|
+
onCopy = (event) => {
|
|
5949
|
+
let selectedRows = this.params.api.getSelectedRows();
|
|
5950
|
+
if (selectedRows.length) {
|
|
5951
|
+
let copiedRowData = selectedRows.map((row) => row.$entity);
|
|
5952
|
+
this.dataGridClipboard.copiedRows('', copiedRowData);
|
|
5953
|
+
}
|
|
5954
|
+
};
|
|
5955
|
+
onPaste = (event) => {
|
|
5956
|
+
let copiedRowData = this.dataGridClipboard.getCopiedRows();
|
|
5957
|
+
copiedRowData.forEach((row) => {
|
|
5958
|
+
let properties = row.entityType.getPropertyNames();
|
|
5959
|
+
properties
|
|
5960
|
+
.filter((propertyName) => {
|
|
5961
|
+
return propertyName !== 'Ref' &&
|
|
5962
|
+
propertyName !== row.entityType.name + 'Ref' &&
|
|
5963
|
+
!this.util.isLowerCase(propertyName.charAt(0));
|
|
5964
|
+
}).forEach((propertyName) => {
|
|
5965
|
+
console.log(propertyName);
|
|
5966
|
+
});
|
|
5967
|
+
});
|
|
5968
|
+
};
|
|
5917
5969
|
agInit(params) {
|
|
5918
5970
|
this.params = params;
|
|
5919
5971
|
if (params.value < 0)
|
|
@@ -5929,7 +5981,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
5929
5981
|
return false;
|
|
5930
5982
|
}
|
|
5931
5983
|
destroy() { }
|
|
5932
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridPkeyCellRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5984
|
+
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 });
|
|
5933
5985
|
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}}
|
|
5934
5986
|
<div style="visibility: hidden; position: fixed"
|
|
5935
5987
|
[style.left]="contextMenuPosition.x"
|
|
@@ -5937,11 +5989,11 @@ class TruDataGridPkeyCellRenderer {
|
|
|
5937
5989
|
[matMenuTriggerFor]="truDataGridContextMenu">
|
|
5938
5990
|
</div>
|
|
5939
5991
|
<mat-menu #truDataGridContextMenu="matMenu">
|
|
5940
|
-
<button mat-menu-item>
|
|
5992
|
+
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
|
|
5941
5993
|
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
5942
5994
|
<span>Copy</span>
|
|
5943
5995
|
</button>
|
|
5944
|
-
<button mat-menu-item disabled>
|
|
5996
|
+
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
5945
5997
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
5946
5998
|
<span>Paste</span>
|
|
5947
5999
|
</button>
|
|
@@ -5968,11 +6020,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
5968
6020
|
[matMenuTriggerFor]="truDataGridContextMenu">
|
|
5969
6021
|
</div>
|
|
5970
6022
|
<mat-menu #truDataGridContextMenu="matMenu">
|
|
5971
|
-
<button mat-menu-item>
|
|
6023
|
+
<button mat-menu-item [disabled]="copyIsDisabled" (click)="onCopy($event)">
|
|
5972
6024
|
<mat-icon [svgIcon]="'copy-icon'"></mat-icon>
|
|
5973
6025
|
<span>Copy</span>
|
|
5974
6026
|
</button>
|
|
5975
|
-
<button mat-menu-item disabled>
|
|
6027
|
+
<button mat-menu-item [disabled]="pasteIsDisabled" (click)="onPaste($event)">
|
|
5976
6028
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
5977
6029
|
<span>Paste</span>
|
|
5978
6030
|
</button>
|
|
@@ -5982,7 +6034,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
5982
6034
|
</button>
|
|
5983
6035
|
</mat-menu>
|
|
5984
6036
|
</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"] }]
|
|
5985
|
-
}], propDecorators: { contextMenu: [{
|
|
6037
|
+
}], ctorParameters: () => [{ type: TruDataGridClipboard }, { type: TruUtil }], propDecorators: { contextMenu: [{
|
|
5986
6038
|
type: ViewChild,
|
|
5987
6039
|
args: [MatMenuTrigger]
|
|
5988
6040
|
}] } });
|