2020-07-10 19:51:36 +02:00
|
|
|
<template>
|
|
|
|
<BaseContextMenu
|
|
|
|
:context-event="contextEvent"
|
2020-08-12 18:11:48 +02:00
|
|
|
@close-context="closeContext"
|
2020-07-10 19:51:36 +02:00
|
|
|
>
|
2021-06-30 19:27:24 +02:00
|
|
|
<div v-if="selectedRows.length === 1" class="context-element">
|
2022-06-21 17:54:47 +02:00
|
|
|
<span class="d-flex"><i class="mdi mdi-18px mdi-content-copy text-light pr-1" /> {{ t('word.copy') }}</span>
|
2021-06-30 19:27:24 +02:00
|
|
|
<i class="mdi mdi-18px mdi-chevron-right text-light pl-1" />
|
|
|
|
<div class="context-submenu">
|
|
|
|
<div
|
|
|
|
v-if="selectedRows.length === 1"
|
|
|
|
class="context-element"
|
|
|
|
@click="copyCell"
|
|
|
|
>
|
|
|
|
<span class="d-flex">
|
2022-06-21 17:54:47 +02:00
|
|
|
<i class="mdi mdi-18px mdi-numeric-0 mdi-rotate-90 text-light pr-1" /> {{ t('word.cell', 1) }}
|
2021-06-30 19:27:24 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-if="selectedRows.length === 1"
|
|
|
|
class="context-element"
|
2022-07-25 12:42:22 +02:00
|
|
|
@click="copyRow('json')"
|
2021-06-30 19:27:24 +02:00
|
|
|
>
|
|
|
|
<span class="d-flex">
|
2022-07-25 12:42:22 +02:00
|
|
|
<i class="mdi mdi-18px mdi-table-row text-light pr-1" /> {{ t('word.row', 1) }} (JSON)
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-if="selectedRows.length === 1"
|
|
|
|
class="context-element"
|
|
|
|
@click="copyRow('sql')"
|
|
|
|
>
|
|
|
|
<span class="d-flex">
|
|
|
|
<i class="mdi mdi-18px mdi-table-row text-light pr-1" /> {{ t('word.row', 1) }} (SQL INSERT)
|
2021-06-30 19:27:24 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-07-19 17:48:51 +02:00
|
|
|
<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>
|
2021-02-28 21:45:38 +01:00
|
|
|
<div
|
2021-07-16 17:09:02 +02:00
|
|
|
v-if="selectedRows.length === 1 && selectedCell.isEditable"
|
2021-02-28 21:45:38 +01:00
|
|
|
class="context-element"
|
|
|
|
@click="setNull"
|
|
|
|
>
|
|
|
|
<span class="d-flex">
|
2022-06-21 17:54:47 +02:00
|
|
|
<i class="mdi mdi-18px mdi-null text-light pr-1" /> {{ t('message.setNull') }}
|
2021-02-28 21:45:38 +01:00
|
|
|
</span>
|
|
|
|
</div>
|
2021-07-16 17:09:02 +02:00
|
|
|
<div
|
|
|
|
v-if="selectedCell.isEditable"
|
|
|
|
class="context-element"
|
|
|
|
@click="showConfirmModal"
|
|
|
|
>
|
2021-02-28 21:45:38 +01:00
|
|
|
<span class="d-flex">
|
2022-06-21 17:54:47 +02:00
|
|
|
<i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ t('message.deleteRows', selectedRows.length) }}
|
2021-02-28 21:45:38 +01:00
|
|
|
</span>
|
2020-07-10 19:51:36 +02:00
|
|
|
</div>
|
|
|
|
</BaseContextMenu>
|
|
|
|
</template>
|
|
|
|
|
2022-06-21 17:54:47 +02:00
|
|
|
<script setup lang="ts">
|
2022-07-19 17:48:51 +02:00
|
|
|
import { Prop } from 'vue';
|
2022-06-21 17:54:47 +02:00
|
|
|
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
|
|
|
import { useI18n } from 'vue-i18n';
|
2020-07-10 19:51:36 +02:00
|
|
|
|
2022-06-21 17:54:47 +02:00
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
|
|
defineProps({
|
|
|
|
contextEvent: MouseEvent,
|
|
|
|
selectedRows: Array,
|
2022-07-19 17:48:51 +02:00
|
|
|
selectedCell: Object,
|
|
|
|
mode: String as Prop<'table' | 'query'>
|
2022-06-21 17:54:47 +02:00
|
|
|
});
|
|
|
|
|
2022-07-19 17:48:51 +02:00
|
|
|
const emit = defineEmits([
|
|
|
|
'show-delete-modal',
|
|
|
|
'close-context',
|
|
|
|
'set-null',
|
|
|
|
'copy-cell',
|
|
|
|
'copy-row',
|
|
|
|
'duplicate-row'
|
|
|
|
]);
|
2022-06-21 17:54:47 +02:00
|
|
|
|
|
|
|
const showConfirmModal = () => {
|
|
|
|
emit('show-delete-modal');
|
|
|
|
};
|
|
|
|
|
|
|
|
const closeContext = () => {
|
|
|
|
emit('close-context');
|
|
|
|
};
|
|
|
|
|
|
|
|
const setNull = () => {
|
|
|
|
emit('set-null');
|
|
|
|
closeContext();
|
|
|
|
};
|
|
|
|
|
|
|
|
const copyCell = () => {
|
|
|
|
emit('copy-cell');
|
|
|
|
closeContext();
|
|
|
|
};
|
|
|
|
|
2022-07-25 12:42:22 +02:00
|
|
|
const copyRow = (format: string) => {
|
|
|
|
emit('copy-row', format);
|
2022-06-21 17:54:47 +02:00
|
|
|
closeContext();
|
2020-07-10 19:51:36 +02:00
|
|
|
};
|
2022-07-19 17:48:51 +02:00
|
|
|
|
|
|
|
const duplicateRow = () => {
|
|
|
|
emit('duplicate-row');
|
|
|
|
closeContext();
|
|
|
|
};
|
2020-07-10 19:51:36 +02:00
|
|
|
</script>
|