|
|
|
@ -2,8 +2,15 @@
|
|
|
|
|
import type { ViewType } from 'nocodb-sdk' |
|
|
|
|
import { ViewTypes } from 'nocodb-sdk' |
|
|
|
|
|
|
|
|
|
const props = defineProps<{ |
|
|
|
|
// Prop used to align the dropdown to the left in sidebar |
|
|
|
|
alignLeftLevel: number | undefined |
|
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
const { $e } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
const alignLeftLevel = toRef(props, 'alignLeftLevel') |
|
|
|
|
|
|
|
|
|
const { refreshCommandPalette } = useCommandPalette() |
|
|
|
|
const viewsStore = useViewsStore() |
|
|
|
|
const { loadViews, navigateToView } = viewsStore |
|
|
|
@ -16,6 +23,14 @@ const toBeCreateType = ref<ViewTypes>()
|
|
|
|
|
|
|
|
|
|
const isOpen = ref(false) |
|
|
|
|
|
|
|
|
|
const overlayClassName = computed(() => { |
|
|
|
|
if (alignLeftLevel.value === 1) return 'nc-view-create-dropdown nc-view-create-dropdown-left-1' |
|
|
|
|
|
|
|
|
|
if (alignLeftLevel.value === 2) return 'nc-view-create-dropdown nc-view-create-dropdown-left-2' |
|
|
|
|
|
|
|
|
|
return 'nc-view-create-dropdown' |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
async function onOpenModal({ |
|
|
|
|
title = '', |
|
|
|
|
type, |
|
|
|
@ -84,7 +99,7 @@ async function onOpenModal({
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<NcDropdown v-model:visible="isOpen" destroy-popup-on-hide @click.stop="isOpen = true"> |
|
|
|
|
<NcDropdown v-model:visible="isOpen" destroy-popup-on-hide :overlay-class-name="overlayClassName" @click.stop="isOpen = true"> |
|
|
|
|
<slot /> |
|
|
|
|
<template #overlay> |
|
|
|
|
<NcMenu class="max-w-48"> |
|
|
|
@ -151,3 +166,17 @@ async function onOpenModal({
|
|
|
|
|
@apply text-brand-400; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
|
.nc-view-create-dropdown { |
|
|
|
|
@apply !max-w-46 !min-w-46; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.nc-view-create-dropdown-left-1 { |
|
|
|
|
@apply !left-18; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.nc-view-create-dropdown-left-2 { |
|
|
|
|
@apply !left-23.5; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|