|
|
|
@ -3,7 +3,16 @@ import type { ColumnType, TableType } from 'nocodb-sdk'
|
|
|
|
|
import type { Ref } from 'vue' |
|
|
|
|
import SmartsheetGrid from '../smartsheet/Grid.vue' |
|
|
|
|
import { computed, inject, provide, useMetas, useProvideSmartsheetStore, watch, watchEffect } from '#imports' |
|
|
|
|
import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj, RightSidebarInj, TabMetaInj } from '~/context' |
|
|
|
|
import { |
|
|
|
|
ActiveViewInj, |
|
|
|
|
FieldsInj, |
|
|
|
|
IsFormInj, |
|
|
|
|
IsLockedInj, |
|
|
|
|
MetaInj, |
|
|
|
|
ReloadViewDataHookInj, |
|
|
|
|
RightSidebarInj, |
|
|
|
|
TabMetaInj, |
|
|
|
|
} from '~/context' |
|
|
|
|
import type { TabItem } from '~/composables' |
|
|
|
|
|
|
|
|
|
const { getMeta, metas } = useMetas() |
|
|
|
@ -27,6 +36,8 @@ watchEffect(async () => {
|
|
|
|
|
|
|
|
|
|
const reloadEventHook = createEventHook<void>() |
|
|
|
|
|
|
|
|
|
const { isGallery, isGrid, isForm } = useProvideSmartsheetStore(activeView as Ref<TableType>, meta) |
|
|
|
|
|
|
|
|
|
// todo: move to store |
|
|
|
|
provide(MetaInj, meta) |
|
|
|
|
provide(TabMetaInj, tabMeta) |
|
|
|
@ -35,8 +46,7 @@ provide(IsLockedInj, false)
|
|
|
|
|
provide(ReloadViewDataHookInj, reloadEventHook) |
|
|
|
|
provide(FieldsInj, fields) |
|
|
|
|
provide(RightSidebarInj, ref(false)) |
|
|
|
|
|
|
|
|
|
const { isGallery, isGrid, isForm } = useProvideSmartsheetStore(activeView as Ref<TableType>, meta) |
|
|
|
|
provide(IsFormInj, isForm) |
|
|
|
|
|
|
|
|
|
watch(tabMeta, async (newTabMeta, oldTabMeta) => { |
|
|
|
|
if (newTabMeta !== oldTabMeta && newTabMeta?.id) await getMeta(newTabMeta.id) |
|
|
|
|