mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 08:36:19 +08:00
fix: improve the dialog and drawer scrollbar experience, fix internal click failure problems and warnings (#4391)
* fix: improve the dialog and drawer scrollbar experience, fix internal click failure problems and warnings * chore: remove test code
This commit is contained in:
@@ -7,6 +7,7 @@ export default defineBuildConfig({
|
||||
{
|
||||
builder: 'mkdist',
|
||||
input: './src',
|
||||
|
||||
pattern: ['**/*'],
|
||||
},
|
||||
{
|
||||
|
@@ -41,6 +41,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-icons/vue": "^1.0.0",
|
||||
"@vben-core/composables": "workspace:*",
|
||||
"@vben-core/icons": "workspace:*",
|
||||
"@vben-core/shared": "workspace:*",
|
||||
"@vben-core/typings": "workspace:*",
|
||||
|
@@ -9,16 +9,19 @@ import {
|
||||
DialogContent,
|
||||
type DialogContentEmits,
|
||||
type DialogContentProps,
|
||||
DialogOverlay,
|
||||
DialogPortal,
|
||||
useForwardPropsEmits,
|
||||
} from 'radix-vue';
|
||||
|
||||
import DialogOverlay from './DialogOverlay.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
{
|
||||
class?: any;
|
||||
closeClass?: any;
|
||||
modal?: boolean;
|
||||
open?: boolean;
|
||||
showClose?: boolean;
|
||||
} & DialogContentProps
|
||||
>(),
|
||||
@@ -27,7 +30,13 @@ const props = withDefaults(
|
||||
const emits = defineEmits<{ close: [] } & DialogContentEmits>();
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, showClose: __, ...delegated } = props;
|
||||
const {
|
||||
class: _,
|
||||
modal: _modal,
|
||||
open: _open,
|
||||
showClose: __,
|
||||
...delegated
|
||||
} = props;
|
||||
|
||||
return delegated;
|
||||
});
|
||||
@@ -43,11 +52,7 @@ defineExpose({
|
||||
|
||||
<template>
|
||||
<DialogPortal>
|
||||
<DialogOverlay
|
||||
class="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 bg-overlay fixed inset-0 z-[1000]"
|
||||
data-dismissable-modal="true"
|
||||
@click="() => emits('close')"
|
||||
/>
|
||||
<DialogOverlay v-if="open && modal" @click="() => emits('close')" />
|
||||
<DialogContent
|
||||
ref="contentRef"
|
||||
v-bind="forwarded"
|
||||
|
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { useScrollLock } from '@vben-core/composables';
|
||||
|
||||
useScrollLock();
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 bg-overlay fixed inset-0 z-[1000]"
|
||||
data-dismissable-modal="true"
|
||||
></div>
|
||||
</template>
|
@@ -7,15 +7,17 @@ import {
|
||||
DialogContent,
|
||||
type DialogContentEmits,
|
||||
type DialogContentProps,
|
||||
DialogOverlay,
|
||||
DialogPortal,
|
||||
useForwardPropsEmits,
|
||||
} from 'radix-vue';
|
||||
|
||||
import { type SheetVariants, sheetVariants } from './sheet';
|
||||
import SheetOverlay from './SheetOverlay.vue';
|
||||
|
||||
interface SheetContentProps extends DialogContentProps {
|
||||
class?: any;
|
||||
modal?: boolean;
|
||||
open?: boolean;
|
||||
side?: SheetVariants['side'];
|
||||
}
|
||||
|
||||
@@ -28,7 +30,13 @@ const props = defineProps<SheetContentProps>();
|
||||
const emits = defineEmits<DialogContentEmits>();
|
||||
|
||||
const delegatedProps = computed(() => {
|
||||
const { class: _, side: _side, ...delegated } = props;
|
||||
const {
|
||||
class: _,
|
||||
modal: _modal,
|
||||
open: _open,
|
||||
side: _side,
|
||||
...delegated
|
||||
} = props;
|
||||
|
||||
return delegated;
|
||||
});
|
||||
@@ -38,10 +46,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
|
||||
<template>
|
||||
<DialogPortal>
|
||||
<DialogOverlay
|
||||
class="bg-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[1000]"
|
||||
data-dismissable-modal="true"
|
||||
/>
|
||||
<SheetOverlay v-if="open && modal" />
|
||||
<DialogContent
|
||||
:class="cn(sheetVariants({ side }), 'z-[1000]', props.class)"
|
||||
v-bind="{ ...forwarded, ...$attrs }"
|
||||
|
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { useScrollLock } from '@vben-core/composables';
|
||||
|
||||
useScrollLock();
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="bg-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[1000]"
|
||||
data-dismissable-modal="true"
|
||||
></div>
|
||||
</template>
|
Reference in New Issue
Block a user