Browse Source

add 'delete row' and 'duplicate row' buttons to edit overaly

pull/4898/head
Daniel Spaude 2 years ago
parent
commit
e8fce731a5
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 55
      packages/nc-gui/components/smartsheet/expanded-form/Header.vue
  2. 69
      packages/nc-gui/components/smartsheet/expanded-form/MoreActions.vue

55
packages/nc-gui/components/smartsheet/expanded-form/Header.vue

@ -127,6 +127,61 @@ useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
</div>
</a-button>
<a-dropdown v-model:visible="open" :trigger="['click']" overlay-class-name="nc-dropdown-actions-menu">
<a-button v-e="['c:actions']" class="nc-actions-menu-btn nc-toolbar-btn">
<div class="flex gap-2 items-center">
<GeneralViewIcon :meta="selectedView"></GeneralViewIcon>
<span class="!text-sm font-weight-normal">
<GeneralTruncateText :key="selectedView?.title">{{ selectedView?.title }}</GeneralTruncateText>
</span>
<component :is="Icon" class="text-gray-500" :class="`nc-icon-${selectedView?.lock_type}`" />
<MdiMenuDown class="text-grey" />
</div>
</a-button>
<template #overlay>
<a-menu class="ml-6 !text-sm !px-0 !py-2 !rounded" data-testid="toolbar-actions" @click="open = false">
<a-menu-item-group>
<a-sub-menu
v-if="isUIAllowed('view-type')"
key="lock-type"
class="scrollbar-thin-dull min-w-50 max-h-90vh overflow-auto !py-0"
>
<template #title>
<div v-e="['c:navdraw:preview-as']" class="nc-project-menu-item group px-0 !py-0">
<LazySmartsheetToolbarLockType hide-tick :type="lockType" />
<MaterialSymbolsChevronRightRounded
class="transform group-hover:(scale-115 text-accent) text-xl text-gray-400"
/>
</div>
</template>
<template #expandIcon></template>
<a-menu-item @click="changeLockType(LockType.Collaborative)">
<LazySmartsheetToolbarLockType :type="LockType.Collaborative" />
</a-menu-item>
<a-menu-item @click="changeLockType(LockType.Locked)">
<LazySmartsheetToolbarLockType :type="LockType.Locked" />
</a-menu-item>
<a-menu-item @click="changeLockType(LockType.Personal)">
<LazySmartsheetToolbarLockType :type="LockType.Personal" />
</a-menu-item>
</a-sub-menu>
<a-menu-divider />
</a-menu-item-group>
</a-menu>
</template>
</a-dropdown>
<a-dropdown-button class="nc-expand-form-save-btn" type="primary" :disabled="!isUIAllowed('tableRowUpdate')" @click="save">
<template #overlay>
<a-menu class="nc-expand-form-save-dropdown-menu">

69
packages/nc-gui/components/smartsheet/expanded-form/MoreActions.vue

@ -0,0 +1,69 @@
<script lang="ts" setup>
// import { ActiveViewInj, FieldsInj, IsPublicInj, MetaInj, inject, ref, useI18n, useNuxtApp, useProject } from '#imports'
// const { t } = useI18n()
// const sharedViewListDlg = ref(false)
// const isPublicView = inject(IsPublicInj, ref(false))
// const isView = false
// const { project } = useProject()
// const { $api } = useNuxtApp()
// const meta = inject(MetaInj, ref())
// const fields = inject(FieldsInj, ref([]))
// const selectedView = inject(ActiveViewInj, ref())
const duplicateRow = () => alert('duplicateRow')
const deleteRow = () => alert('deleteRow')
</script>
<template>
<div>
<a-dropdown>
<a-button v-e="['c:actions']" class="nc-actions-menu-btn nc-toolbar-btn">
<div class="flex gap-1 items-center">
<MdiFlashOutline />
<!-- More -->
<span class="!text-sm font-weight-medium">{{ $t('general.more') }}</span>
<MdiMenuDown class="text-grey" />
</div>
</a-button>
<template #overlay>
<div class="bg-gray-50 py-2 shadow-lg !border">
<div>
<div v-e="['a:actions:download-csv']" class="nc-menu-item" @click="duplicateRow">
<MdiDownloadOutline class="text-gray-500" />
{{ $t('activity.duplicateRow') }}
</div>
<div v-e="['a:actions:download-excel']" class="nc-menu-item" @click="deleteRow">
<MdiDownloadOutline class="text-gray-500" />
{{ $t('activity.deleteRow') }}
</div>
</div>
</div>
</template>
</a-dropdown>
<a-modal
v-model:visible="sharedViewListDlg"
:class="{ active: sharedViewListDlg }"
:title="$t('activity.listSharedView')"
width="max(900px,60vw)"
:footer="null"
wrap-class-name="nc-modal-shared-view-list"
>
<LazySmartsheetToolbarSharedViewList v-if="sharedViewListDlg" />
</a-modal>
</div>
</template>
Loading…
Cancel
Save