Skip to content

Commit 0909644

Browse files
committed
fix: close module flow panel on click outside
1 parent 7644196 commit 0909644

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

packages/devtools/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"@types/diff": "catalog:types",
6464
"@types/stream-json": "catalog:types",
6565
"@unocss/nuxt": "catalog:build",
66+
"@vueuse/components": "catalog:frontend",
6667
"@vueuse/nuxt": "catalog:build",
6768
"@vueuse/router": "catalog:frontend",
6869
"codemirror": "catalog:frontend",

packages/devtools/src/app/pages/session/[session]/graph/index.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { SessionContext } from '~~/shared/types'
33
import { useRoute, useRouter } from '#app/composables/router'
44
import { clearUndefined } from '@antfu/utils'
5+
import { vOnClickOutside } from '@vueuse/components'
56
import { computedWithControl, debouncedWatch } from '@vueuse/core'
67
import Fuse from 'fuse.js'
78
import { computed, reactive, ref } from 'vue'
@@ -126,6 +127,10 @@ function toggleDisplay() {
126127
}
127128
display.value = display.value === 'list' ? 'graph' : 'list'
128129
}
130+
131+
function closeFlowPanel() {
132+
router.replace({ query: { ...route.query, module: undefined } })
133+
}
129134
</script>
130135

131136
<template>
@@ -194,12 +199,13 @@ function toggleDisplay() {
194199
</div>
195200

196201
<div
197-
v-if="route.query.module" fixed inset-0 backdrop-blur-5
202+
v-if="route.query.module" fixed inset-0
203+
backdrop-blur-5
198204
z-panel-content
199-
@click="router.replace({ query: { ...route.query, module: undefined } })"
200205
>
201206
<div
202207
:key="(route.query.module as string)"
208+
v-on-click-outside="closeFlowPanel"
203209
fixed right-0 bottom-0 top-20 z-panel-content
204210
min-w-200 of-scroll bg-glass border="l t base rounded-tl-xl"
205211
max-w-85vw
@@ -210,7 +216,7 @@ function toggleDisplay() {
210216
/>
211217
<DisplayCloseButton
212218
absolute right-2 top-2
213-
@click="router.replace({ query: { ...route.query, module: undefined } })"
219+
@click="closeFlowPanel"
214220
/>
215221
</div>
216222
</div>

pnpm-lock.yaml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ catalogs:
5151
vite-plugin-inspect: ^11.2.0
5252
vue-tsc: ^2.2.10
5353
frontend:
54+
'@vueuse/components': ^13.4.0
5455
'@vueuse/router': ^13.4.0
5556
codemirror: ^5.65.19
5657
codemirror-theme-vars: ^0.1.2

0 commit comments

Comments
 (0)