1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: context menu option to duplicate a table row

This commit is contained in:
2022-07-19 17:48:51 +02:00
parent 78902639eb
commit 985e5d3527
5 changed files with 100 additions and 38 deletions

View File

@ -27,6 +27,15 @@
</div>
</div>
</div>
<div
v-if="selectedRows.length === 1 && selectedCell.isEditable && mode === 'table'"
class="context-element"
@click="duplicateRow"
>
<span class="d-flex">
<i class="mdi mdi-18px mdi-content-duplicate text-light pr-1" /> {{ t('word.duplicate') }}
</span>
</div>
<div
v-if="selectedRows.length === 1 && selectedCell.isEditable"
class="context-element"
@ -49,6 +58,7 @@
</template>
<script setup lang="ts">
import { Prop } from 'vue';
import BaseContextMenu from '@/components/BaseContextMenu.vue';
import { useI18n } from 'vue-i18n';
@ -57,10 +67,18 @@ const { t } = useI18n();
defineProps({
contextEvent: MouseEvent,
selectedRows: Array,
selectedCell: Object
selectedCell: Object,
mode: String as Prop<'table' | 'query'>
});
const emit = defineEmits(['show-delete-modal', 'close-context', 'set-null', 'copy-cell', 'copy-row']);
const emit = defineEmits([
'show-delete-modal',
'close-context',
'set-null',
'copy-cell',
'copy-row',
'duplicate-row'
]);
const showConfirmModal = () => {
emit('show-delete-modal');
@ -84,4 +102,9 @@ const copyRow = () => {
emit('copy-row');
closeContext();
};
const duplicateRow = () => {
emit('duplicate-row');
closeContext();
};
</script>