Skip to content

Commit 1049b66

Browse files
Michael.KryvoruchkoMichael.Kryvoruchko
authored andcommitted
feat: add teleport controls
- teleportTo to change teleport 'to' prop. 'body' by default. - disableTeleport allows to disable teleports at all
1 parent f7c37de commit 1049b66

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/components/GDialog.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ export default defineComponent({
7474
7575
scrollable: Boolean,
7676
77+
/**
78+
* CSS selector string or an actual DOM node where
79+
* where to teleport dialog when it is opened.
80+
*/
81+
teleportTo: {
82+
type: String,
83+
default: 'body',
84+
},
85+
86+
/**
87+
* disables teleport.
88+
*/
89+
disableTeleport: Boolean,
90+
7791
transition: {
7892
type: String,
7993
default: 'g-dialog-transition',
@@ -206,7 +220,7 @@ export default defineComponent({
206220
<slot name="activator" v-bind="activatorAttrs" />
207221

208222
<template v-if="activatedOnce">
209-
<Teleport to="body" :disabled="local">
223+
<Teleport :to="teleportTo" :disabled="local || disableTeleport">
210224
<GDialogOverlay
211225
v-if="!fullscreen"
212226
ref="overlayComponent"
@@ -218,7 +232,7 @@ export default defineComponent({
218232
/>
219233
</Teleport>
220234

221-
<Teleport to="body" :disabled="local">
235+
<Teleport :to="teleportTo" :disabled="local || disableTeleport">
222236
<GDialogFrame
223237
ref="frameComponent"
224238
:is-active="isActive"

0 commit comments

Comments
 (0)