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