Browse Source

chore(nc-gui): cleanup

pull/3801/head
braks 2 years ago
parent
commit
d33142b3c3
  1. 3
      packages/nc-gui/components/smartsheet/sidebar/index.vue
  2. 14
      packages/nc-gui/components/tabs/Smartsheet.vue
  3. 18
      packages/nc-gui/nuxt.config.ts
  4. 6
      packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue

3
packages/nc-gui/components/smartsheet/sidebar/index.vue

@ -8,6 +8,7 @@ import {
inject, inject,
provide, provide,
ref, ref,
useNuxtApp,
useRoute, useRoute,
useRouter, useRouter,
useSidebar, useSidebar,
@ -102,7 +103,7 @@ function onCreate(view: ViewType) {
ref="sidebar" ref="sidebar"
:collapsed="sidebarCollapsed" :collapsed="sidebarCollapsed"
collapsiple collapsiple
collapsed-width="50" collapsed-width="0"
width="250" width="250"
class="relative shadow-md h-full" class="relative shadow-md h-full"
theme="light" theme="light"

14
packages/nc-gui/components/tabs/Smartsheet.vue

@ -15,6 +15,7 @@ import {
inject, inject,
provide, provide,
ref, ref,
toRef,
useMetas, useMetas,
useProvideSmartsheetStore, useProvideSmartsheetStore,
useSidebar, useSidebar,
@ -22,24 +23,24 @@ import {
} from '#imports' } from '#imports'
import type { TabItem } from '~/lib' import type { TabItem } from '~/lib'
const { activeTab } = defineProps<{ const props = defineProps<{
activeTab: TabItem activeTab: TabItem
}>() }>()
const { metas } = useMetas() const { metas } = useMetas()
const activeView = ref() const activeTab = toRef(props, 'activeTab')
const el = ref() const activeView = ref()
const fields = ref<ColumnType[]>([]) const fields = ref<ColumnType[]>([])
provide(TabMetaInj, ref(activeTab)) const meta = computed<TableType | undefined>(() => metas.value[activeTab.value.id!])
const meta = computed<TableType>(() => metas.value?.[activeTab?.id as string])
const reloadEventHook = createEventHook() const reloadEventHook = createEventHook()
const reloadViewMetaEventHook = createEventHook() const reloadViewMetaEventHook = createEventHook()
const openNewRecordFormHook = createEventHook() const openNewRecordFormHook = createEventHook()
const { isGallery, isGrid, isForm, isLocked } = useProvideSmartsheetStore(activeView, meta) const { isGallery, isGrid, isForm, isLocked } = useProvideSmartsheetStore(activeView, meta)
@ -56,6 +57,7 @@ provide(ReloadViewMetaHookInj, reloadViewMetaEventHook)
provide(OpenNewRecordFormHookInj, openNewRecordFormHook) provide(OpenNewRecordFormHookInj, openNewRecordFormHook)
provide(FieldsInj, fields) provide(FieldsInj, fields)
provide(IsFormInj, isForm) provide(IsFormInj, isForm)
provide(TabMetaInj, activeTab)
const treeViewIsLockedInj = inject('TreeViewIsLockedInj', ref(false)) const treeViewIsLockedInj = inject('TreeViewIsLockedInj', ref(false))
@ -71,7 +73,7 @@ watch(isLocked, (nextValue) => (treeViewIsLockedInj.value = nextValue), { immedi
<template v-if="meta"> <template v-if="meta">
<div class="flex flex-1 min-h-0"> <div class="flex flex-1 min-h-0">
<div v-if="activeView" class="h-full flex-1 min-w-0 min-h-0 bg-gray-50"> <div v-if="activeView" class="h-full flex-1 min-w-0 min-h-0 bg-gray-50">
<LazySmartsheetGrid v-if="isGrid" :ref="el" /> <LazySmartsheetGrid v-if="isGrid" />
<LazySmartsheetGallery v-else-if="isGallery" /> <LazySmartsheetGallery v-else-if="isGallery" />

18
packages/nc-gui/nuxt.config.ts

@ -14,6 +14,15 @@ export default defineNuxtConfig({
ssr: false, ssr: false,
app: { app: {
pageTransition: {
name: 'page',
mode: 'out-in',
},
layoutTransition: {
name: 'layout',
mode: 'out-in',
},
/** In production build we need to load assets using relative path, to achieve the result we are using cdnURL */ /** In production build we need to load assets using relative path, to achieve the result we are using cdnURL */
cdnURL: process.env.NODE_ENV === 'production' ? '.' : undefined, cdnURL: process.env.NODE_ENV === 'production' ? '.' : undefined,
}, },
@ -166,13 +175,4 @@ export default defineNuxtConfig({
{ name: 'useJwt', from: '@vueuse/integrations/useJwt' }, { name: 'useJwt', from: '@vueuse/integrations/useJwt' },
], ],
}, },
pageTransition: {
name: 'page',
mode: 'out-in',
},
layoutTransition: {
name: 'layout',
mode: 'out-in',
},
}) })

6
packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue

@ -81,14 +81,8 @@ function onEdit(targetKey: number, action: 'add' | 'remove' | string) {
</div> </div>
<div class="w-full min-h-[300px] flex-auto"> <div class="w-full min-h-[300px] flex-auto">
<div v-show="!isLoadingProject" class="w-full h-full">
<NuxtPage /> <NuxtPage />
</div> </div>
<div v-show="isLoadingProject" class="w-full h-full flex justify-center items-center">
<a-spin size="large" />
</div>
</div>
</div> </div>
</div> </div>
</template> </template>

Loading…
Cancel
Save