|
|
@ -10,7 +10,6 @@ import { |
|
|
|
MetaInj, |
|
|
|
MetaInj, |
|
|
|
OpenNewRecordFormHookInj, |
|
|
|
OpenNewRecordFormHookInj, |
|
|
|
ReloadViewDataHookInj, |
|
|
|
ReloadViewDataHookInj, |
|
|
|
TabMetaInj, |
|
|
|
|
|
|
|
computed, |
|
|
|
computed, |
|
|
|
inject, |
|
|
|
inject, |
|
|
|
provide, |
|
|
|
provide, |
|
|
@ -18,12 +17,11 @@ import { |
|
|
|
useMetas, |
|
|
|
useMetas, |
|
|
|
useProvideSmartsheetStore, |
|
|
|
useProvideSmartsheetStore, |
|
|
|
watch, |
|
|
|
watch, |
|
|
|
watchEffect, |
|
|
|
|
|
|
|
} from '#imports' |
|
|
|
} from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
import type { TabItem } from '~/composables' |
|
|
|
import type { TabItem } from '~/composables' |
|
|
|
|
|
|
|
|
|
|
|
const { getMeta, metas } = useMetas() |
|
|
|
const { metas } = useMetas() |
|
|
|
|
|
|
|
|
|
|
|
const activeView = ref() |
|
|
|
const activeView = ref() |
|
|
|
|
|
|
|
|
|
|
@ -35,13 +33,8 @@ const tabMeta = inject( |
|
|
|
TabMetaInj, |
|
|
|
TabMetaInj, |
|
|
|
computed(() => ({} as TabItem)), |
|
|
|
computed(() => ({} as TabItem)), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const meta = computed<TableType>(() => metas.value?.[tabMeta?.value?.id as string]) |
|
|
|
const meta = computed<TableType>(() => metas.value?.[tabMeta?.value?.id as string]) |
|
|
|
|
|
|
|
|
|
|
|
watchEffect(async () => { |
|
|
|
|
|
|
|
await getMeta(tabMeta?.value?.id as string) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const reloadEventHook = createEventHook<void>() |
|
|
|
const reloadEventHook = createEventHook<void>() |
|
|
|
const openNewRecordFormHook = createEventHook<void>() |
|
|
|
const openNewRecordFormHook = createEventHook<void>() |
|
|
|
|
|
|
|
|
|
|
@ -52,7 +45,6 @@ provideSidebar({ storageKey: 'nc-right-sidebar' }) |
|
|
|
|
|
|
|
|
|
|
|
// todo: move to store |
|
|
|
// todo: move to store |
|
|
|
provide(MetaInj, meta) |
|
|
|
provide(MetaInj, meta) |
|
|
|
provide(TabMetaInj, tabMeta) |
|
|
|
|
|
|
|
provide(ActiveViewInj, activeView) |
|
|
|
provide(ActiveViewInj, activeView) |
|
|
|
provide(IsLockedInj, isLocked) |
|
|
|
provide(IsLockedInj, isLocked) |
|
|
|
provide(ReloadViewDataHookInj, reloadEventHook) |
|
|
|
provide(ReloadViewDataHookInj, reloadEventHook) |
|
|
@ -62,10 +54,6 @@ provide(IsFormInj, isForm) |
|
|
|
|
|
|
|
|
|
|
|
const treeViewIsLockedInj = inject('TreeViewIsLockedInj', ref(false)) |
|
|
|
const treeViewIsLockedInj = inject('TreeViewIsLockedInj', ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
watch(tabMeta, async (newTabMeta, oldTabMeta) => { |
|
|
|
|
|
|
|
if (newTabMeta !== oldTabMeta && newTabMeta?.id) await getMeta(newTabMeta.id) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(isLocked, (nextValue) => (treeViewIsLockedInj.value = nextValue), { immediate: true }) |
|
|
|
watch(isLocked, (nextValue) => (treeViewIsLockedInj.value = nextValue), { immediate: true }) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|