fix: enabled copy context on non editable rows

This commit is contained in:
Fabio Di Stasio 2021-07-16 17:09:02 +02:00
parent 7845e3e501
commit 525c964c62
3 changed files with 12 additions and 7 deletions

View File

@ -10,6 +10,7 @@
v-if="isContext"
:context-event="contextEvent"
:selected-rows="selectedRows"
:selected-cell="selectedCell"
@show-delete-modal="showDeleteConfirmModal"
@set-null="setNull"
@copy-cell="copyCell"

View File

@ -28,7 +28,7 @@
</div>
</div>
<div
v-if="selectedRows.length === 1"
v-if="selectedRows.length === 1 && selectedCell.isEditable"
class="context-element"
@click="setNull"
>
@ -36,7 +36,11 @@
<i class="mdi mdi-18px mdi-null text-light pr-1" /> {{ $t('message.setNull') }}
</span>
</div>
<div class="context-element" @click="showConfirmModal">
<div
v-if="selectedCell.isEditable"
class="context-element"
@click="showConfirmModal"
>
<span class="d-flex">
<i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
</span>
@ -54,7 +58,8 @@ export default {
},
props: {
contextEvent: MouseEvent,
selectedRows: Array
selectedRows: Array,
selectedCell: Object
},
computed: {
},

View File

@ -506,10 +506,9 @@ export default {
return this.keyUsage.find(key => key.field === keyName);
},
openContext (event, payload) {
if (this.isEditable) {
payload.field = this.fields[payload.field].name;// Ensures field name only
this.$emit('contextmenu', event, payload);
}
payload.field = this.fields[payload.field].name;// Ensures field name only
payload.isEditable = this.isEditable;
this.$emit('contextmenu', event, payload);
},
onKey (e) {
e.stopPropagation();