@trudb/tru-common-lib 0.1.978 → 0.1.981
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.
|
@@ -6957,6 +6957,7 @@ class TruDataGrid {
|
|
|
6957
6957
|
isActive = true;
|
|
6958
6958
|
rowSelectedOnMousedown = null;
|
|
6959
6959
|
rowFocuedOnMousedown = null;
|
|
6960
|
+
copiedRowData = [];
|
|
6960
6961
|
constructor(dataContext, componentLookup, searchResultViewManager, appEnvironment, searchViewEventHandler, uiNotification, connectionHub, windowEventHandler, util, app, tabGroupEventNotifier) {
|
|
6961
6962
|
this.dataContext = dataContext;
|
|
6962
6963
|
this.componentLookup = componentLookup;
|
|
@@ -7312,19 +7313,42 @@ class TruDataGrid {
|
|
|
7312
7313
|
if (gridConfig.colDef.cellClass === 'ag-pk-aligned-cell')
|
|
7313
7314
|
this.config.rowHeaderDoubleClicked(gridConfig);
|
|
7314
7315
|
};
|
|
7315
|
-
onCellKeyDown = (
|
|
7316
|
-
if (!
|
|
7316
|
+
onCellKeyDown = (params) => {
|
|
7317
|
+
if (!params.event)
|
|
7317
7318
|
return;
|
|
7318
|
-
const
|
|
7319
|
-
if (
|
|
7320
|
-
|
|
7321
|
-
|
|
7319
|
+
const event = params.event;
|
|
7320
|
+
if (event.code === 'Space') {
|
|
7321
|
+
event.preventDefault();
|
|
7322
|
+
event.stopPropagation();
|
|
7322
7323
|
this.api?.startEditingCell({
|
|
7323
|
-
rowIndex:
|
|
7324
|
-
colKey:
|
|
7325
|
-
key:
|
|
7324
|
+
rowIndex: params.rowIndex,
|
|
7325
|
+
colKey: params.column.getColId(),
|
|
7326
|
+
key: event.code
|
|
7326
7327
|
});
|
|
7327
7328
|
}
|
|
7329
|
+
else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyC') {
|
|
7330
|
+
let selectedRows = this.api.getSelectedRows();
|
|
7331
|
+
if (selectedRows.length) {
|
|
7332
|
+
this.copiedRowData = selectedRows.map((row) => row.$entity);
|
|
7333
|
+
}
|
|
7334
|
+
}
|
|
7335
|
+
else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyV') {
|
|
7336
|
+
if (this.copiedRowData.length) {
|
|
7337
|
+
this.copiedRowData.forEach((row) => {
|
|
7338
|
+
let newEntity = this.dataContext.entityAccess().add(this.config.resultConfig.entityType);
|
|
7339
|
+
var properties = row.getPropertyNames();
|
|
7340
|
+
properties
|
|
7341
|
+
.filter((propertyName) => {
|
|
7342
|
+
return propertyName !== 'Ref' && propertyName !== this.config.resultConfig.entityType + 'Ref';
|
|
7343
|
+
})
|
|
7344
|
+
.forEach((propertyName) => {
|
|
7345
|
+
if (typeof newEntity.setProperty !== 'undefined')
|
|
7346
|
+
newEntity.setProperty(propertyName, row.getProperty(propertyName));
|
|
7347
|
+
});
|
|
7348
|
+
this.addEntity(newEntity);
|
|
7349
|
+
});
|
|
7350
|
+
}
|
|
7351
|
+
}
|
|
7328
7352
|
};
|
|
7329
7353
|
onCellMouseOver(e) {
|
|
7330
7354
|
let targetElement = e.event.target;
|