Browse Source

fix(gui-v2): typing issue in smartsheet

pull/2877/head
braks 2 years ago
parent
commit
43050ce8b3
  1. 24
      packages/nc-gui-v2/components/tabs/Smartsheet.vue

24
packages/nc-gui-v2/components/tabs/Smartsheet.vue

@ -1,16 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ColumnType, ViewType } from 'nocodb-sdk' import type { ColumnType } from 'nocodb-sdk'
import { ViewTypes } from 'nocodb-sdk' import { ViewTypes } from 'nocodb-sdk'
import SmartsheetGrid from '../smartsheet/Grid.vue'
import { computed, inject, provide, useMetas, watch, watchEffect } from '#imports' import { computed, inject, provide, useMetas, watch, watchEffect } from '#imports'
import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj, TabMetaInj } from '~/context' import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj, TabMetaInj } from '~/context'
import type { TabItem } from '~/composables'
const { getMeta, metas } = useMetas() const { getMeta, metas } = useMetas()
const activeView = ref<ViewType>() const activeView = ref()
const el = ref<any>()
const el = ref<typeof SmartsheetGrid>()
const fields = ref<ColumnType[]>([]) const fields = ref<ColumnType[]>([])
const tabMeta = inject(TabMetaInj) const tabMeta = inject(
TabMetaInj,
computed(() => ({} as TabItem)),
)
const meta = computed(() => metas.value?.[tabMeta?.value?.id as string]) const meta = computed(() => metas.value?.[tabMeta?.value?.id as string])
@ -28,12 +35,9 @@ provide(ReloadViewDataHookInj, reloadEventHook)
provide(FieldsInj, fields) provide(FieldsInj, fields)
provide('navDrawerOpen', ref(true)) provide('navDrawerOpen', ref(true))
watch( watch(tabMeta, async (newTabMeta, oldTabMeta) => {
() => tabMeta && tabMeta.value.id, if (newTabMeta !== oldTabMeta && newTabMeta.id) await getMeta(newTabMeta.id)
async (newVal, oldVal) => { })
if (newVal !== oldVal) await getMeta(newVal)
},
)
</script> </script>
<template> <template>

Loading…
Cancel
Save