diff --git a/packages/nc-gui-v2/components/dlg/ViewCreate.vue b/packages/nc-gui-v2/components/dlg/ViewCreate.vue new file mode 100644 index 0000000000..a287ab02e0 --- /dev/null +++ b/packages/nc-gui-v2/components/dlg/ViewCreate.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/packages/nc-gui-v2/components/dlg/VueCreate.vue b/packages/nc-gui-v2/components/dlg/VueCreate.vue deleted file mode 100644 index 102f034131..0000000000 --- a/packages/nc-gui-v2/components/dlg/VueCreate.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - - - diff --git a/packages/nc-gui-v2/components/index.ts b/packages/nc-gui-v2/components/index.ts index ef87664295..751984d570 100644 --- a/packages/nc-gui-v2/components/index.ts +++ b/packages/nc-gui-v2/components/index.ts @@ -3,6 +3,8 @@ import type { InjectionKey, Ref } from 'vue' import type { EventHook } from '@vueuse/core' import type useViewData from '~/composables/useViewData' +export type ViewType = (GridType | GalleryType | FormType | KanbanType) & { id?: string } + export const ColumnInj: InjectionKey = Symbol('column-injection') export const MetaInj: InjectionKey> = Symbol('meta-injection') export const TabMetaInj: InjectionKey = Symbol('tab-meta-injection') @@ -13,9 +15,8 @@ export const IsFormInj: InjectionKey = Symbol('is-form-injection') export const IsGridInj: InjectionKey = Symbol('is-grid-injection') export const IsLockedInj: InjectionKey = Symbol('is-locked-injection') export const ValueInj: InjectionKey = Symbol('value-injection') -export const ActiveViewInj: InjectionKey> = - Symbol('active-view-injection') +export const ActiveViewInj: InjectionKey> = Symbol('active-view-injection') export const ReadonlyInj: InjectionKey = Symbol('readonly-injection') export const ReloadViewDataHookInj: InjectionKey> = Symbol('reload-view-data-injection') export const FieldsInj: InjectionKey> = Symbol('fields-injection') -export const ViewListInj: InjectionKey> = Symbol('view-list-injection') +export const ViewListInj: InjectionKey> = Symbol('view-list-injection') diff --git a/packages/nc-gui-v2/components/smartsheet/Sidebar.vue b/packages/nc-gui-v2/components/smartsheet/Sidebar.vue index dae39ebebe..ac0f39c748 100644 --- a/packages/nc-gui-v2/components/smartsheet/Sidebar.vue +++ b/packages/nc-gui-v2/components/smartsheet/Sidebar.vue @@ -3,7 +3,7 @@ import { ViewTypes } from 'nocodb-sdk' import type { TableType } from 'nocodb-sdk' import type { Ref } from 'vue' import { inject, ref } from '#imports' -import { ActiveViewInj, MetaInj } from '~/components' +import { ActiveViewInj, MetaInj, ViewListInj } from '~/components' import useViews from '~/composables/useViews' import { viewIcons } from '~/utils/viewUtils' import MdiPlusIcon from '~icons/mdi/plus' @@ -17,6 +17,7 @@ provide(ViewListInj, views) const _isUIAllowed = (view: string) => {} +// todo decide based on route param loadViews().then(() => { activeView.value = views.value?.[0] }) @@ -25,12 +26,19 @@ const toggleDrawer = ref(false) // todo: identify based on meta const isView = ref(false) const viewCreateType = ref() -const viewCreateDlg = ref() +const viewCreateDlg = ref(false) const openCreateViewDlg = (type: ViewTypes) => { viewCreateDlg.value = true viewCreateType.value = type } + +const onViewCreate = (view)=>{ + views.value?.push(view) + activeView.value = view + viewCreateDlg.value = false +} +