|
|
@ -2,17 +2,20 @@ |
|
|
|
import type { TableType } from 'nocodb-sdk' |
|
|
|
import type { TableType } from 'nocodb-sdk' |
|
|
|
import type { Ref } from 'vue' |
|
|
|
import type { Ref } from 'vue' |
|
|
|
import { inject, onMounted, ref } from '#imports' |
|
|
|
import { inject, onMounted, ref } from '#imports' |
|
|
|
import { MetaInj } from '~/components' |
|
|
|
import { ActiveViewInj, MetaInj } from '~/components' |
|
|
|
import useViews from '~/composables/useViews' |
|
|
|
import useViews from '~/composables/useViews' |
|
|
|
import { viewIcons } from '~/utils/viewUtils' |
|
|
|
import { viewIcons } from '~/utils/viewUtils' |
|
|
|
|
|
|
|
|
|
|
|
const meta = inject(MetaInj) |
|
|
|
const meta = inject(MetaInj) |
|
|
|
|
|
|
|
const activeView = inject(ActiveViewInj) |
|
|
|
|
|
|
|
|
|
|
|
const { views, loadViews } = useViews(meta as Ref<TableType>) |
|
|
|
const { views, loadViews } = useViews(meta as Ref<TableType>) |
|
|
|
const _isUIAllowed = (view: string) => {} |
|
|
|
const _isUIAllowed = (view: string) => {} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(loadViews) |
|
|
|
loadViews().then(() => { |
|
|
|
|
|
|
|
activeView.value = views.value?.[0] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const selectedViewIdLocal = ref('') |
|
|
|
|
|
|
|
const toggleDrawer = ref(false) |
|
|
|
const toggleDrawer = ref(false) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
@ -31,7 +34,8 @@ const toggleDrawer = ref(false) |
|
|
|
<!-- Views --> |
|
|
|
<!-- Views --> |
|
|
|
<span class="body-2 font-weight-medium">{{ $t('objects.views') }}</span> |
|
|
|
<span class="body-2 font-weight-medium">{{ $t('objects.views') }}</span> |
|
|
|
</v-list-item> |
|
|
|
</v-list-item> |
|
|
|
<v-list-group v-model="selectedViewIdLocal" mandatory color="primary"> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <v-list-group v-model="selectedViewIdLocal" mandatory color="primary"> --> |
|
|
|
<!-- |
|
|
|
<!-- |
|
|
|
todo: add sortable |
|
|
|
todo: add sortable |
|
|
|
<draggable |
|
|
|
<draggable |
|
|
@ -46,40 +50,43 @@ const toggleDrawer = ref(false) |
|
|
|
:name="!drag ? 'flip-list' : null" |
|
|
|
:name="!drag ? 'flip-list' : null" |
|
|
|
> --> |
|
|
|
> --> |
|
|
|
<v-list-item |
|
|
|
<v-list-item |
|
|
|
v-for="(view, i) in views" |
|
|
|
v-for="view in views" |
|
|
|
:key="view.id" |
|
|
|
:key="view.id" |
|
|
|
v-t="['a:view:open', { view: view.type }]" |
|
|
|
v-t="['a:view:open', { view: view.type }]" |
|
|
|
dense |
|
|
|
dense |
|
|
|
:value="view.id" |
|
|
|
:value="view.id" |
|
|
|
active-class="x-active--text" |
|
|
|
active-class="x-active--text" |
|
|
|
|
|
|
|
@click="activeView = view" |
|
|
|
> |
|
|
|
> |
|
|
|
<!-- :class="`body-2 view nc-view-item nc-draggable-child nc-${ |
|
|
|
<!-- :class="`body-2 view nc-view-item nc-draggable-child nc-${ |
|
|
|
viewTypeAlias[view.type] |
|
|
|
viewTypeAlias[view.type] |
|
|
|
}-view-item`" |
|
|
|
}-view-item`" |
|
|
|
@click="$emit('rerender')" --> |
|
|
|
@click="$emit('rerender')" --> |
|
|
|
<v-icon |
|
|
|
<!-- <v-icon |
|
|
|
v-if="_isUIAllowed('viewlist-drag-n-drop')" |
|
|
|
v-if="_isUIAllowed('viewlist-drag-n-drop')" |
|
|
|
small |
|
|
|
small |
|
|
|
:class="`nc-child-draggable-icon nc-child-draggable-icon-${view.title}`" |
|
|
|
:class="`nc-child-draggable-icon nc-child-draggable-icon-${view.title}`" |
|
|
|
@click.stop |
|
|
|
@click.stop |
|
|
|
> |
|
|
|
> |
|
|
|
mdi-drag-vertical |
|
|
|
mdi-drag-vertical |
|
|
|
</v-icon> |
|
|
|
</v-icon> --> |
|
|
|
<v-list-item-icon class="mr-n1"> |
|
|
|
<!-- <v-list-item-icon class="mr-n1"> |
|
|
|
<v-icon v-if="viewIcons[view.type]" x-small :color="viewIcons[view.type].color"> |
|
|
|
<v-icon v-if="viewIcons[view.type]" x-small :color="viewIcons[view.type].color"> |
|
|
|
{{ viewIcons[view.type].icon }} |
|
|
|
{{ viewIcons[view.type].icon }} |
|
|
|
</v-icon> |
|
|
|
</v-icon> |
|
|
|
<v-icon v-else color="primary" small> mdi-table </v-icon> |
|
|
|
<v-icon v-else color="primary" small> mdi-table </v-icon> |
|
|
|
</v-list-item-icon> |
|
|
|
</v-list-item-icon> --> |
|
|
|
<v-list-item-title> |
|
|
|
<span>{{ view.alias || view.title }}</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <v-list-item-title> |
|
|
|
<v-tooltip bottom> |
|
|
|
<v-tooltip bottom> |
|
|
|
<template #activator="{ on }"> |
|
|
|
<template #activator="{ on }"> |
|
|
|
<div class="font-weight-regular" style="overflow: hidden; text-overflow: ellipsis"> |
|
|
|
<div class="font-weight-regular" style="overflow: hidden; text-overflow: ellipsis"> |
|
|
|
<input v-if="view.edit" :ref="`input${i}`" v-model="view.title_temp" /> |
|
|
|
<input v-if="view.edit" :ref="`input${i}`" v-model="view.title_temp" /> |
|
|
|
|
|
|
|
|
|
|
|
<!-- @click.stop |
|
|
|
<!– @click.stop |
|
|
|
@keydown.enter.stop="updateViewName(view, i)" |
|
|
|
@keydown.enter.stop="updateViewName(view, i)" |
|
|
|
@blur="updateViewName(view, i)" --> |
|
|
|
@blur="updateViewName(view, i)" –> |
|
|
|
<template v-else> |
|
|
|
<template v-else> |
|
|
|
<span v-on="on">{{ view.alias || view.title }}</span> |
|
|
|
<span v-on="on">{{ view.alias || view.title }}</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -87,7 +94,7 @@ const toggleDrawer = ref(false) |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
{{ view.alias || view.title }} |
|
|
|
{{ view.alias || view.title }} |
|
|
|
</v-tooltip> |
|
|
|
</v-tooltip> |
|
|
|
</v-list-item-title> |
|
|
|
</v-list-item-title> --> |
|
|
|
<v-spacer /> |
|
|
|
<v-spacer /> |
|
|
|
<!-- <template v-if="_isUIAllowed('virtualViewsCreateOrEdit')"> |
|
|
|
<!-- <template v-if="_isUIAllowed('virtualViewsCreateOrEdit')"> |
|
|
|
<!– Copy view –> |
|
|
|
<!– Copy view –> |
|
|
@ -134,7 +141,7 @@ const toggleDrawer = ref(false) |
|
|
|
</v-list-item> |
|
|
|
</v-list-item> |
|
|
|
<!-- </transition-group> --> |
|
|
|
<!-- </transition-group> --> |
|
|
|
<!-- </draggable> --> |
|
|
|
<!-- </draggable> --> |
|
|
|
</v-list-group> |
|
|
|
<!-- </v-list-group> --> |
|
|
|
</v-list> |
|
|
|
</v-list> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|