|
|
@ -6,15 +6,17 @@ const { $e } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
|
|
const { refreshCommandPalette } = useCommandPalette() |
|
|
|
const { refreshCommandPalette } = useCommandPalette() |
|
|
|
const viewsStore = useViewsStore() |
|
|
|
const viewsStore = useViewsStore() |
|
|
|
const { views } = storeToRefs(viewsStore) |
|
|
|
|
|
|
|
const { loadViews, navigateToView } = viewsStore |
|
|
|
const { loadViews, navigateToView } = viewsStore |
|
|
|
|
|
|
|
|
|
|
|
const table = inject(SidebarTableInj)! |
|
|
|
const table = inject(SidebarTableInj)! |
|
|
|
const project = inject(ProjectInj)! |
|
|
|
const project = inject(ProjectInj)! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isViewListLoading = ref(false) |
|
|
|
|
|
|
|
const toBeCreateType = ref<ViewTypes>() |
|
|
|
|
|
|
|
|
|
|
|
const isOpen = ref(false) |
|
|
|
const isOpen = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
function onOpenModal({ |
|
|
|
async function onOpenModal({ |
|
|
|
title = '', |
|
|
|
title = '', |
|
|
|
type, |
|
|
|
type, |
|
|
|
copyViewId, |
|
|
|
copyViewId, |
|
|
@ -25,7 +27,17 @@ function onOpenModal({ |
|
|
|
copyViewId?: string |
|
|
|
copyViewId?: string |
|
|
|
groupingFieldColumnId?: string |
|
|
|
groupingFieldColumnId?: string |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
|
|
|
|
if (isViewListLoading.value) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toBeCreateType.value = type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isViewListLoading.value = true |
|
|
|
|
|
|
|
await loadViews({ |
|
|
|
|
|
|
|
tableId: table.value.id!, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
isOpen.value = false |
|
|
|
isOpen.value = false |
|
|
|
|
|
|
|
isViewListLoading.value = false |
|
|
|
|
|
|
|
|
|
|
|
const isDlgOpen = ref(true) |
|
|
|
const isDlgOpen = ref(true) |
|
|
|
|
|
|
|
|
|
|
@ -36,7 +48,6 @@ function onOpenModal({ |
|
|
|
'tableId': table.value.id, |
|
|
|
'tableId': table.value.id, |
|
|
|
'selectedViewId': copyViewId, |
|
|
|
'selectedViewId': copyViewId, |
|
|
|
groupingFieldColumnId, |
|
|
|
groupingFieldColumnId, |
|
|
|
'views': views, |
|
|
|
|
|
|
|
'onUpdate:modelValue': closeDialog, |
|
|
|
'onUpdate:modelValue': closeDialog, |
|
|
|
'onCreated': async (view: ViewType) => { |
|
|
|
'onCreated': async (view: ViewType) => { |
|
|
|
closeDialog() |
|
|
|
closeDialog() |
|
|
@ -44,6 +55,7 @@ function onOpenModal({ |
|
|
|
refreshCommandPalette() |
|
|
|
refreshCommandPalette() |
|
|
|
|
|
|
|
|
|
|
|
await loadViews({ |
|
|
|
await loadViews({ |
|
|
|
|
|
|
|
tableId: table.value.id!, |
|
|
|
force: true, |
|
|
|
force: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -64,25 +76,24 @@ function onOpenModal({ |
|
|
|
|
|
|
|
|
|
|
|
function closeDialog() { |
|
|
|
function closeDialog() { |
|
|
|
isOpen.value = false |
|
|
|
isOpen.value = false |
|
|
|
|
|
|
|
|
|
|
|
close(1000) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<NcDropdown v-model:isOpen="isOpen" destroy-popup-on-hide @click.stop="isOpen = !isOpen"> |
|
|
|
<NcDropdown v-model:visible="isOpen" destroy-popup-on-hide @click.stop="isOpen = true"> |
|
|
|
<slot /> |
|
|
|
<slot /> |
|
|
|
<template #overlay> |
|
|
|
<template #overlay> |
|
|
|
<NcMenu class="max-w-48"> |
|
|
|
<NcMenu class="max-w-48"> |
|
|
|
<NcMenuItem @click="onOpenModal({ type: ViewTypes.GRID })"> |
|
|
|
<NcMenuItem @click.stop="onOpenModal({ type: ViewTypes.GRID })"> |
|
|
|
<div class="item" data-testid="sidebar-view-create-grid"> |
|
|
|
<div class="item" data-testid="sidebar-view-create-grid"> |
|
|
|
<div class="item-inner"> |
|
|
|
<div class="item-inner"> |
|
|
|
<GeneralViewIcon :meta="{ type: ViewTypes.GRID }" /> |
|
|
|
<GeneralViewIcon :meta="{ type: ViewTypes.GRID }" /> |
|
|
|
<div>Grid</div> |
|
|
|
<div>Grid</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<GeneralIcon class="plus" icon="plus" /> |
|
|
|
<GeneralLoader v-if="toBeCreateType === ViewTypes.GRID && isViewListLoading" /> |
|
|
|
|
|
|
|
<GeneralIcon v-else class="plus" icon="plus" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</NcMenuItem> |
|
|
|
</NcMenuItem> |
|
|
|
|
|
|
|
|
|
|
@ -93,7 +104,8 @@ function onOpenModal({ |
|
|
|
<div>Form</div> |
|
|
|
<div>Form</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<GeneralIcon class="plus" icon="plus" /> |
|
|
|
<GeneralLoader v-if="toBeCreateType === ViewTypes.FORM && isViewListLoading" /> |
|
|
|
|
|
|
|
<GeneralIcon v-else class="plus" icon="plus" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</NcMenuItem> |
|
|
|
</NcMenuItem> |
|
|
|
<NcMenuItem @click="onOpenModal({ type: ViewTypes.GALLERY })"> |
|
|
|
<NcMenuItem @click="onOpenModal({ type: ViewTypes.GALLERY })"> |
|
|
@ -103,7 +115,8 @@ function onOpenModal({ |
|
|
|
<div>Gallery</div> |
|
|
|
<div>Gallery</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<GeneralIcon class="plus" icon="plus" /> |
|
|
|
<GeneralLoader v-if="toBeCreateType === ViewTypes.GALLERY && isViewListLoading" /> |
|
|
|
|
|
|
|
<GeneralIcon v-else class="plus" icon="plus" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</NcMenuItem> |
|
|
|
</NcMenuItem> |
|
|
|
<NcMenuItem data-testid="sidebar-view-create-kanban" @click="onOpenModal({ type: ViewTypes.KANBAN })"> |
|
|
|
<NcMenuItem data-testid="sidebar-view-create-kanban" @click="onOpenModal({ type: ViewTypes.KANBAN })"> |
|
|
@ -113,7 +126,8 @@ function onOpenModal({ |
|
|
|
<div>Kanban</div> |
|
|
|
<div>Kanban</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<GeneralIcon class="plus" icon="plus" /> |
|
|
|
<GeneralLoader v-if="toBeCreateType === ViewTypes.KANBAN && isViewListLoading" /> |
|
|
|
|
|
|
|
<GeneralIcon v-else class="plus" icon="plus" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</NcMenuItem> |
|
|
|
</NcMenuItem> |
|
|
|
</NcMenu> |
|
|
|
</NcMenu> |
|
|
|