Browse Source

feat(gui-v2): virtual column delete

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2947/head
Pranav C 2 years ago
parent
commit
52a876a523
  1. 7
      packages/nc-gui-v2/components/smartsheet-header/Menu.vue
  2. 65
      packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue

7
packages/nc-gui-v2/components/smartsheet-header/Menu.vue

@ -4,7 +4,7 @@ import { inject } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
import { useNuxtApp } from '#app' import { useNuxtApp } from '#app'
import useMetas from '~/composables/useMetas' import { useMetas } from '#imports'
import { ColumnInj, MetaInj } from '~/context' import { ColumnInj, MetaInj } from '~/context'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' import { extractSdkResponseErrorMsg } from '~/utils/errorUtils'
import MdiEditIcon from '~icons/mdi/pencil' import MdiEditIcon from '~icons/mdi/pencil'
@ -12,6 +12,7 @@ import MdiStarIcon from '~icons/mdi/star'
import MdiDeleteIcon from '~icons/mdi/delete-outline' import MdiDeleteIcon from '~icons/mdi/delete-outline'
import MdiMenuDownIcon from '~icons/mdi/menu-down' import MdiMenuDownIcon from '~icons/mdi/menu-down'
const { virtual = false } = defineProps<{ virtual?: boolean }>()
const editColumnDropdown = $ref(false) const editColumnDropdown = $ref(false)
const column = inject(ColumnInj) const column = inject(ColumnInj)
@ -61,12 +62,12 @@ const setAsPrimaryValue = async () => {
<MdiMenuDownIcon class="text-grey" /> <MdiMenuDownIcon class="text-grey" />
<template #overlay> <template #overlay>
<div class="shadow bg-white"> <div class="shadow bg-white">
<div class="nc-column-edit nc-menu-item" @click="editColumnDropdown = true"> <div v-if="!virtual" class="nc-column-edit nc-menu-item" @click="editColumnDropdown = true">
<MdiEditIcon class="text-primary" /> <MdiEditIcon class="text-primary" />
<!-- Edit --> <!-- Edit -->
{{ $t('general.edit') }} {{ $t('general.edit') }}
</div> </div>
<div v-t="['a:column:set-primary']" class="nc-menu-item" @click="setAsPrimaryValue"> <div v-if="!virtual" v-t="['a:column:set-primary']" class="nc-menu-item" @click="setAsPrimaryValue">
<MdiStarIcon class="text-primary" /> <MdiStarIcon class="text-primary" />
<!-- todo : tooltip --> <!-- todo : tooltip -->

65
packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue

@ -145,71 +145,8 @@ provide(ColumnInj, column)
<!-- </v-tooltip> --> <!-- </v-tooltip> -->
<v-spacer /> <v-spacer />
<!--
todo: implement delete or edit column
<v-menu <SmartsheetHeaderMenu :virtual="true"/>
v-if="!isLocked && !isVirtual && !isPublicView && _isUIAllowed('edit-column') && !isForm"
offset-y
open-on-hover
left
transition="slide-y-transition"
>
<template #activator="{ on }">
<v-icon v-if="!isLocked && !isForm" small v-on="on"> mdi-menu-down </v-icon>
</template>
<v-list dense>
<v-list-item dense @click="editColumnMenu = true">
<x-icon small class="mr-1 nc-column-edit" color="primary"> mdi-pencil </x-icon>
<span class="caption">
&lt;!&ndash; Edit &ndash;&gt;
{{ $t('general.edit') }}
</span>
</v-list-item>
<v-list-item @click="columnDeleteDialog = true">
<x-icon small class="mr-1 nc-column-delete" color="error"> mdi-delete-outline </x-icon>
<span class="caption">
&lt;!&ndash; Delete &ndash;&gt;
{{ $t('general.delete') }}
</span>
</v-list-item>
</v-list>
</v-menu>
<v-dialog v-model="columnDeleteDialog" max-width="500" persistent>
<v-card>
<v-card-title class="grey darken-2 subheading white&#45;&#45;text"> Confirm </v-card-title>
<v-divider />
<v-card-text class="mt-4 title">
Do you want to delete <span class="font-weight-bold">'{{ column.title }}'</span> column ?
</v-card-text>
<v-divider />
<v-card-actions class="d-flex pa-4">
<v-spacer />
<v-btn small @click="columnDeleteDialog = false">
&lt;!&ndash; Cancel &ndash;&gt;
{{ $t('general.cancel') }}
</v-btn>
<v-btn v-t="['a:column:delete']" small color="error" @click="deleteColumn"> Confirm </v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-menu v-model="editColumnMenu" offset-y content-class="" left transition="slide-y-transition">
<template #activator="{ on }">
<span v-on="on" />
</template>
<edit-virtual-column
v-if="editColumnMenu"
v-model="editColumnMenu"
:nodes="nodes"
:edit-column="true"
:column="column"
:meta="meta"
:sql-ui="sqlUi"
v-on="$listeners"
/>
</v-menu> -->
</div> </div>
</template> </template>

Loading…
Cancel
Save