From 5ec0ac6ce70c57d697fb67cfce149ed192877050 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Thu, 28 Sep 2023 04:27:01 +0000 Subject: [PATCH] fix: Fixed tablenode and view node click issue in mobile and removed edit mode on view node on mobile --- .../nc-gui/components/dashboard/TreeView/TableNode.vue | 5 +++++ .../nc-gui/components/dashboard/TreeView/ViewsList.vue | 10 ++++++++-- .../nc-gui/components/dashboard/TreeView/ViewsNode.vue | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/dashboard/TreeView/TableNode.vue b/packages/nc-gui/components/dashboard/TreeView/TableNode.vue index 82d171caf2..58bb70fb11 100644 --- a/packages/nc-gui/components/dashboard/TreeView/TableNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/TableNode.vue @@ -46,6 +46,7 @@ const { setMenuContext, openRenameTableDialog, duplicateTable } = inject(TreeVie const { loadViews: _loadViews } = useViewsStore() const { activeView } = storeToRefs(useViewsStore()) +const { isLeftSidebarOpen } = storeToRefs(useSidebarStore()) // todo: temp const { projectTables } = storeToRefs(useTablesStore()) @@ -108,6 +109,10 @@ const onOpenTable = async () => { isLoading.value = true try { await _openTable(table.value) + + if (isMobileMode.value) { + isLeftSidebarOpen.value = false + } } catch (e) { message.error(await extractSdkResponseErrorMsg(e)) } finally { diff --git a/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue b/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue index ebf160e01f..06d46892e2 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue @@ -31,6 +31,8 @@ const emits = defineEmits() const project = inject(ProjectInj)! const table = inject(SidebarTableInj)! +const { isLeftSidebarOpen } = storeToRefs(useSidebarStore()) + const { isMobileMode } = useGlobal() const { $e } = useNuxtApp() @@ -190,13 +192,17 @@ const initSortable = (el: HTMLElement) => { onMounted(() => menuRef.value && initSortable(menuRef.value.$el)) /** Navigate to view by changing url param */ -function changeView(view: ViewType) { - navigateToView({ +async function changeView(view: ViewType) { + await navigateToView({ view, tableId: table.value.id!, projectId: project.value.id!, hardReload: view.type === ViewTypes.FORM && selected.value[0] === view.id, }) + + if (isMobileMode.value) { + isLeftSidebarOpen.value = false + } } /** Rename a view */ diff --git a/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue b/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue index b43f1b24a0..b18be63089 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue @@ -80,6 +80,7 @@ const onClick = useDebounceFn(() => { /** Enable editing view name on dbl click */ function onDblClick() { + if (isMobileMode.value) return if (!isUIAllowed('viewCreateOrEdit')) return if (!isEditing.value) {