|
|
@ -6,6 +6,7 @@ import Sortable from 'sortablejs' |
|
|
|
import type { Menu as AntMenu } from 'ant-design-vue' |
|
|
|
import type { Menu as AntMenu } from 'ant-design-vue' |
|
|
|
import { |
|
|
|
import { |
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
|
|
|
|
isDefaultBase, |
|
|
|
message, |
|
|
|
message, |
|
|
|
onMounted, |
|
|
|
onMounted, |
|
|
|
parseProp, |
|
|
|
parseProp, |
|
|
@ -32,6 +33,10 @@ const table = inject(SidebarTableInj)! |
|
|
|
|
|
|
|
|
|
|
|
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore()) |
|
|
|
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { activeTableId } = storeToRefs(useTablesStore()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { isUIAllowed } = useRoles() |
|
|
|
|
|
|
|
|
|
|
|
const { isMobileMode } = useGlobal() |
|
|
|
const { isMobileMode } = useGlobal() |
|
|
|
|
|
|
|
|
|
|
|
const { $e } = useNuxtApp() |
|
|
|
const { $e } = useNuxtApp() |
|
|
@ -77,6 +82,13 @@ function markItem(id: string) { |
|
|
|
}, 300) |
|
|
|
}, 300) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isDefaultSource = computed(() => { |
|
|
|
|
|
|
|
const source = base.value?.sources?.find((b) => b.id === table.value.source_id) |
|
|
|
|
|
|
|
if (!source) return false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return isDefaultBase(source) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
/** validate view title */ |
|
|
|
/** validate view title */ |
|
|
|
function validate(view: ViewType) { |
|
|
|
function validate(view: ViewType) { |
|
|
|
if (!view.title || view.title.trim().length < 0) { |
|
|
|
if (!view.title || view.title.trim().length < 0) { |
|
|
@ -367,12 +379,41 @@ function onOpenModal({ |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<a-menu |
|
|
|
<a-menu |
|
|
|
v-if="views.length" |
|
|
|
|
|
|
|
ref="menuRef" |
|
|
|
ref="menuRef" |
|
|
|
:class="{ dragging }" |
|
|
|
:class="{ dragging }" |
|
|
|
class="nc-views-menu flex flex-col w-full !border-r-0 !bg-inherit" |
|
|
|
class="nc-views-menu flex flex-col w-full !border-r-0 !bg-inherit" |
|
|
|
:selected-keys="selected" |
|
|
|
:selected-keys="selected" |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<DashboardTreeViewCreateViewBtn |
|
|
|
|
|
|
|
v-if="isUIAllowed('viewCreateOrEdit')" |
|
|
|
|
|
|
|
:class="{ |
|
|
|
|
|
|
|
'!pl-18 !xs:(pl-19.75)': isDefaultSource, |
|
|
|
|
|
|
|
'!pl-23.5 !xs:(pl-27)': !isDefaultSource, |
|
|
|
|
|
|
|
}" |
|
|
|
|
|
|
|
:align-left-level="isDefaultSource ? 1 : 2" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
role="button" |
|
|
|
|
|
|
|
class="nc-create-view-btn flex flex-row items-center cursor-pointer rounded-md w-full" |
|
|
|
|
|
|
|
:class="{ |
|
|
|
|
|
|
|
'text-brand-500 hover:text-brand-600': activeTableId === table.id, |
|
|
|
|
|
|
|
'text-gray-500 hover:text-brand-500': activeTableId !== table.id, |
|
|
|
|
|
|
|
}" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div class="flex flex-row items-center pl-1.25 !py-1.5 text-inherit"> |
|
|
|
|
|
|
|
<GeneralIcon icon="plus" /> |
|
|
|
|
|
|
|
<div class="pl-1.75"> |
|
|
|
|
|
|
|
{{ |
|
|
|
|
|
|
|
$t('general.createEntity', { |
|
|
|
|
|
|
|
entity: $t('objects.view'), |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</DashboardTreeViewCreateViewBtn> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template v-if="views.length"> |
|
|
|
<DashboardTreeViewViewsNode |
|
|
|
<DashboardTreeViewViewsNode |
|
|
|
v-for="view of views" |
|
|
|
v-for="view of views" |
|
|
|
:id="view.id" |
|
|
|
:id="view.id" |
|
|
@ -392,6 +433,7 @@ function onOpenModal({ |
|
|
|
@rename="onRename" |
|
|
|
@rename="onRename" |
|
|
|
@select-icon="setIcon($event, view)" |
|
|
|
@select-icon="setIcon($event, view)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
</a-menu> |
|
|
|
</a-menu> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|