@trudb/tru-common-lib 0.2.106 → 0.2.108
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.
|
@@ -5951,8 +5951,12 @@ class TruDataGridCellRenderer {
|
|
|
5951
5951
|
}
|
|
5952
5952
|
|
|
5953
5953
|
class TruDataGridClipboard {
|
|
5954
|
+
util;
|
|
5954
5955
|
tableName = null;
|
|
5955
5956
|
rowData = [];
|
|
5957
|
+
constructor(util) {
|
|
5958
|
+
this.util = util;
|
|
5959
|
+
}
|
|
5956
5960
|
copiedRows = (tableName, rowData) => {
|
|
5957
5961
|
this.tableName = tableName;
|
|
5958
5962
|
this.rowData = rowData;
|
|
@@ -5960,7 +5964,28 @@ class TruDataGridClipboard {
|
|
|
5960
5964
|
getCopiedRows = () => {
|
|
5961
5965
|
return this.rowData;
|
|
5962
5966
|
};
|
|
5963
|
-
|
|
5967
|
+
paste = (gridApi, column, rowNode) => {
|
|
5968
|
+
};
|
|
5969
|
+
insertRowsAtTop = (dataContext, config, addEntity) => {
|
|
5970
|
+
if (this.rowData.length) {
|
|
5971
|
+
this.rowData.forEach((row) => {
|
|
5972
|
+
let newEntity = dataContext.entityAccess().add(config.resultConfig.entityType);
|
|
5973
|
+
let properties = row.entityType.getPropertyNames();
|
|
5974
|
+
properties
|
|
5975
|
+
.filter((propertyName) => {
|
|
5976
|
+
return propertyName !== 'Ref' &&
|
|
5977
|
+
propertyName !== config.resultConfig.entityType.name + 'Ref' &&
|
|
5978
|
+
!this.util.isLowerCase(propertyName.charAt(0));
|
|
5979
|
+
})
|
|
5980
|
+
.forEach((propertyName) => {
|
|
5981
|
+
if (typeof newEntity.setProperty !== 'undefined')
|
|
5982
|
+
newEntity.setProperty(propertyName, row.getProperty(propertyName));
|
|
5983
|
+
});
|
|
5984
|
+
addEntity(newEntity, false);
|
|
5985
|
+
});
|
|
5986
|
+
}
|
|
5987
|
+
};
|
|
5988
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, deps: [{ token: TruUtil }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5964
5989
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, providedIn: 'root' });
|
|
5965
5990
|
}
|
|
5966
5991
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridClipboard, decorators: [{
|
|
@@ -5968,9 +5993,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
5968
5993
|
args: [{
|
|
5969
5994
|
providedIn: 'root',
|
|
5970
5995
|
}]
|
|
5971
|
-
}] });
|
|
5996
|
+
}], ctorParameters: () => [{ type: TruUtil }] });
|
|
5972
5997
|
|
|
5973
5998
|
class TruDataGridPkeyCellRenderer {
|
|
5999
|
+
dataContext;
|
|
5974
6000
|
dataGridClipboard;
|
|
5975
6001
|
util;
|
|
5976
6002
|
contextMenu;
|
|
@@ -5979,9 +6005,11 @@ class TruDataGridPkeyCellRenderer {
|
|
|
5979
6005
|
displayValue = '';
|
|
5980
6006
|
copyIsDisabled = true;
|
|
5981
6007
|
pasteIsDisabled = true;
|
|
6008
|
+
insertAtTopIsDisabled = true;
|
|
5982
6009
|
// private eGui: is an empty element to satisfy the getGui method.
|
|
5983
6010
|
eGui;
|
|
5984
|
-
constructor(dataGridClipboard, util) {
|
|
6011
|
+
constructor(dataContext, dataGridClipboard, util) {
|
|
6012
|
+
this.dataContext = dataContext;
|
|
5985
6013
|
this.dataGridClipboard = dataGridClipboard;
|
|
5986
6014
|
this.util = util;
|
|
5987
6015
|
}
|
|
@@ -5989,6 +6017,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
5989
6017
|
event.preventDefault();
|
|
5990
6018
|
this.copyIsDisabled = this.params.api.getSelectedRows().length ? false : true;
|
|
5991
6019
|
this.pasteIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
|
|
6020
|
+
this.insertAtTopIsDisabled = this.dataGridClipboard.getCopiedRows().length && this.params.api.getSelectedRows().length ? false : true;
|
|
5992
6021
|
this.contextMenuPosition.x = event.pageX + 'px';
|
|
5993
6022
|
this.contextMenuPosition.y = (event.pageY) + 'px';
|
|
5994
6023
|
this.contextMenu.menu?.focusFirstItem('mouse');
|
|
@@ -6019,6 +6048,9 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6019
6048
|
});
|
|
6020
6049
|
});
|
|
6021
6050
|
};
|
|
6051
|
+
onInsertAtTop = (event) => {
|
|
6052
|
+
this.dataGridClipboard.insertRowsAtTop(this.dataContext, this.params.context.grid.config, this.params.context.grid.addEntity);
|
|
6053
|
+
};
|
|
6022
6054
|
agInit(params) {
|
|
6023
6055
|
this.params = params;
|
|
6024
6056
|
if (params.value < 0)
|
|
@@ -6040,7 +6072,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6040
6072
|
this.params.eGridCell.removeEventListener('mousedown', this.onMouseDown);
|
|
6041
6073
|
this.params.eGridCell.removeEventListener('mousedown', this.onMouseUp);
|
|
6042
6074
|
}
|
|
6043
|
-
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 });
|
|
6075
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridPkeyCellRenderer, deps: [{ token: TruDataContext }, { token: TruDataGridClipboard }, { token: TruUtil }], target: i0.ɵɵFactoryTarget.Component });
|
|
6044
6076
|
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}}
|
|
6045
6077
|
<div style="visibility: hidden; position: relative"
|
|
6046
6078
|
[style.left]="contextMenuPosition.x"
|
|
@@ -6055,7 +6087,7 @@ class TruDataGridPkeyCellRenderer {
|
|
|
6055
6087
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6056
6088
|
<span>Paste</span>
|
|
6057
6089
|
</button>
|
|
6058
|
-
<button mat-menu-item>
|
|
6090
|
+
<button mat-menu-item [disabled]="insertAtTopIsDisabled" (click)="onInsertAtTop($event)">
|
|
6059
6091
|
<mat-icon [svgIcon]="'insert-icon'"></mat-icon>
|
|
6060
6092
|
<span>Insert At Top</span>
|
|
6061
6093
|
</button>
|
|
@@ -6085,13 +6117,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
6085
6117
|
<mat-icon [svgIcon]="'paste-icon'"></mat-icon>
|
|
6086
6118
|
<span>Paste</span>
|
|
6087
6119
|
</button>
|
|
6088
|
-
<button mat-menu-item>
|
|
6120
|
+
<button mat-menu-item [disabled]="insertAtTopIsDisabled" (click)="onInsertAtTop($event)">
|
|
6089
6121
|
<mat-icon [svgIcon]="'insert-icon'"></mat-icon>
|
|
6090
6122
|
<span>Insert At Top</span>
|
|
6091
6123
|
</button>
|
|
6092
6124
|
</mat-menu>
|
|
6093
6125
|
</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"] }]
|
|
6094
|
-
}], ctorParameters: () => [{ type: TruDataGridClipboard }, { type: TruUtil }], propDecorators: { contextMenu: [{
|
|
6126
|
+
}], ctorParameters: () => [{ type: TruDataContext }, { type: TruDataGridClipboard }, { type: TruUtil }], propDecorators: { contextMenu: [{
|
|
6095
6127
|
type: ViewChild,
|
|
6096
6128
|
args: [MatMenuTrigger]
|
|
6097
6129
|
}] } });
|
|
@@ -7100,6 +7132,9 @@ class TruDataGrid {
|
|
|
7100
7132
|
rowCount = 'Rows: 0';
|
|
7101
7133
|
selectedRowCount = 'Selected: 0';
|
|
7102
7134
|
gridOptions = {
|
|
7135
|
+
context: {
|
|
7136
|
+
grid: this
|
|
7137
|
+
},
|
|
7103
7138
|
getRowId: (params) => { return params.data.$entity.Ref.toString(); },
|
|
7104
7139
|
animateRows: false,
|
|
7105
7140
|
rowSelection: 'multiple',
|