fix: cell copy returns "undefined" in some conditions, closes #170

This commit is contained in:
Fabio Di Stasio 2022-01-14 18:37:37 +01:00
parent 020ce36312
commit 8fb1f0803e
3 changed files with 5 additions and 4 deletions

View File

@ -136,7 +136,7 @@
"clean-webpack-plugin": "^4.0.0", "clean-webpack-plugin": "^4.0.0",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"css-loader": "^6.5.0", "css-loader": "^6.5.0",
"electron": "^16.0.1", "electron": "^16.0.7",
"electron-builder": "^22.14.11", "electron-builder": "^22.14.11",
"electron-devtools-installer": "^3.2.0", "electron-devtools-installer": "^3.2.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",

View File

@ -403,10 +403,11 @@ export default {
}; };
this.$emit('update-field', params); this.$emit('update-field', params);
}, },
copyCell () { copyCell (event) {
const row = this.localResults.find(row => this.selectedRows.includes(row._antares_id)); const row = this.localResults.find(row => this.selectedRows.includes(row._antares_id));
const cellName = Object.keys(row).find(prop => [ const cellName = Object.keys(row).find(prop => [
this.selectedCell.field, this.selectedCell.field,
this.selectedCell.orgField,
`${this.fields[0].table}.${this.selectedCell.field}`, `${this.fields[0].table}.${this.selectedCell.field}`,
`${this.fields[0].tableAlias}.${this.selectedCell.field}` `${this.fields[0].tableAlias}.${this.selectedCell.field}`
].includes(prop)); ].includes(prop));

View File

@ -10,7 +10,7 @@
:key="cKey" :key="cKey"
class="td p-0" class="td p-0"
tabindex="0" tabindex="0"
@contextmenu.prevent="openContext($event, { id: row._antares_id, field: cKey })" @contextmenu.prevent="openContext($event, { id: row._antares_id, orgField: cKey })"
> >
<template v-if="cKey !== '_antares_id'"> <template v-if="cKey !== '_antares_id'">
<span <span
@ -526,7 +526,7 @@ export default {
return this.keyUsage.find(key => key.field === keyName); return this.keyUsage.find(key => key.field === keyName);
}, },
openContext (event, payload) { openContext (event, payload) {
payload.field = this.fields[payload.field].name;// Ensures field name only payload.field = this.fields[payload.orgField].name;// Ensures field name only
payload.isEditable = this.isEditable; payload.isEditable = this.isEditable;
this.$emit('contextmenu', event, payload); this.$emit('contextmenu', event, payload);
}, },