Browse Source

refactor(nc-gui): move types to lib

pull/3669/head
braks 2 years ago committed by Raju Udava
parent
commit
b658df011b
  1. 21
      packages/nc-gui/components/smartsheet/toolbar/ShareView.vue
  2. 3
      packages/nc-gui/composables/useSharedFormViewStore.ts
  3. 16
      packages/nc-gui/lib/types.ts

21
packages/nc-gui/components/smartsheet/toolbar/ShareView.vue

@ -16,21 +16,7 @@ import {
useUIPermission,
watch,
} from '#imports'
import type { ThemeConfig } from '~/lib'
interface SharedViewMeta extends Record<string, any> {
surveyMode?: boolean
theme?: Partial<ThemeConfig>
allowCSVDownload?: boolean
}
interface SharedView {
uuid?: string
id: string
password?: string
type?: ViewTypes
meta: SharedViewMeta
}
import type { SharedView } from '~/lib'
const { theme } = useTheme()
@ -73,7 +59,10 @@ const surveyMode = computed({
const viewTheme = computed({
get: () => !!shared.value.meta.theme,
set: (hasTheme) => {
shared.value.meta = { ...shared.value.meta, theme: hasTheme ? { ...theme.value } : undefined }
shared.value.meta = {
...shared.value.meta,
theme: hasTheme ? { ...theme.value } : undefined,
}
saveTheme()
},
})

3
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -18,6 +18,7 @@ import {
useProvideSmartsheetRowStore,
watch,
} from '#imports'
import type { SharedViewMeta } from '~/lib'
const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((sharedViewId: string) => {
const progress = ref(false)
@ -34,7 +35,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
const sharedFormView = ref<FormType>()
const meta = ref<TableType>()
const columns = ref<(ColumnType & { required?: boolean; show?: boolean; label?: string })[]>()
const sharedViewMeta = ref<any>({})
const sharedViewMeta = ref<SharedViewMeta>({})
const formResetHook = createEventHook<void>()
const { api, isLoading } = useApi()

16
packages/nc-gui/lib/types.ts

@ -1,4 +1,4 @@
import type { FilterType } from 'nocodb-sdk'
import type { FilterType, ViewTypes } from 'nocodb-sdk'
import type { I18n } from 'vue-i18n'
import type { Theme as AntTheme } from 'ant-design-vue/es/config-provider'
import type { ProjectRole, Role, TabType } from './enums'
@ -70,3 +70,17 @@ export interface TabItem {
viewTitle?: string
viewId?: string
}
export interface SharedViewMeta extends Record<string, any> {
surveyMode?: boolean
theme?: Partial<ThemeConfig>
allowCSVDownload?: boolean
}
export interface SharedView {
uuid?: string
id: string
password?: string
type?: ViewTypes
meta: SharedViewMeta
}

Loading…
Cancel
Save