Skip to content

Commit e4ef644

Browse files
committed
FaModalFaDrawer 组件添加 zIndex 属性
1 parent 522a97f commit e4ef644

File tree

8 files changed

+27
-7
lines changed

8 files changed

+27
-7
lines changed

src/ui/components/FaDrawer/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Drawer from './index.vue'
55
export interface DrawerProps {
66
id?: string
77
modelValue?: boolean
8+
zIndex?: number
89
side?: 'top' | 'bottom' | 'left' | 'right'
910
title?: string
1011
description?: string

src/ui/components/FaDrawer/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const props = withDefaults(
1818
defineProps<DrawerProps>(),
1919
{
2020
modelValue: false,
21+
zIndex: 2000,
2122
side: 'right',
2223
loading: false,
2324
closable: true,
@@ -162,6 +163,7 @@ function handleAnimationEnd() {
162163
<SheetContent
163164
:drawer-id="drawerId"
164165
:open="isOpen"
166+
:z-index="props.zIndex"
165167
:closable="props.closable"
166168
:overlay="props.overlay"
167169
:overlay-blur="props.overlayBlur"

src/ui/components/FaDrawer/sheet/SheetContent.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ import { sheetVariants } from '.'
1515
1616
interface SheetContentProps extends DialogContentProps {
1717
drawerId: string
18-
class?: HTMLAttributes['class']
1918
open?: boolean
19+
zIndex?: number
2020
side?: SheetVariants['side']
2121
closable?: boolean
2222
overlay?: boolean
2323
overlayBlur?: boolean
24+
class?: HTMLAttributes['class']
2425
}
2526
2627
defineOptions({
@@ -65,13 +66,19 @@ watch(showOverlay, (val) => {
6566
<div
6667
v-if="showOverlay"
6768
:data-drawer-id="props.drawerId"
68-
:class="cn('fixed inset-0 z-2000 data-[state=closed]:animate-out data-[state=open]:animate-in bg-black/50 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0', {
69+
:class="cn('fixed inset-0 data-[state=closed]:animate-out data-[state=open]:animate-in bg-black/50 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0', {
6970
'backdrop-blur-sm': props.overlayBlur,
7071
})"
72+
:style="{
73+
zIndex: props.zIndex,
74+
}"
7175
/>
7276
</Transition>
7377
<DialogContent
7478
:class="cn(sheetVariants({ side }), props.class)"
79+
:style="{
80+
zIndex: props.zIndex,
81+
}"
7582
v-bind="{ ...forwarded, ...$attrs }"
7683
@animationend="emits('animationEnd')"
7784
>

src/ui/components/FaDrawer/sheet/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export { default as SheetTitle } from './SheetTitle.vue'
1111
export { default as SheetTrigger } from './SheetTrigger.vue'
1212

1313
export const sheetVariants = cva(
14-
'fixed z-2000 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:animate-duration-300 data-[state=open]:animate-duration-500',
14+
'fixed gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:animate-duration-300 data-[state=open]:animate-duration-500',
1515
{
1616
variants: {
1717
side: {

src/ui/components/FaModal/dialog/DialogContent.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ import { cn } from '@/utils'
1313
1414
const props = defineProps<DialogContentProps & {
1515
modalId: string
16-
class?: HTMLAttributes['class']
1716
open?: boolean
17+
zIndex?: number
1818
maximize?: boolean
1919
maximizable?: boolean
2020
closable?: boolean
2121
overlay?: boolean
2222
overlayBlur?: boolean
23+
class?: HTMLAttributes['class']
2324
}>()
2425
const emits = defineEmits<DialogContentEmits & {
2526
toggleMaximize: [val: boolean]
@@ -68,19 +69,25 @@ watch(showOverlay, (val) => {
6869
<div
6970
v-if="showOverlay"
7071
:data-modal-id="props.modalId"
71-
:class="cn('fixed inset-0 z-2000 data-[state=closed]:animate-out data-[state=open]:animate-in bg-black/50 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0', {
72+
:class="cn('fixed inset-0 data-[state=closed]:animate-out data-[state=open]:animate-in bg-black/50 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0', {
7273
'backdrop-blur-sm': props.overlayBlur,
7374
})"
75+
:style="{
76+
zIndex: props.zIndex,
77+
}"
7478
/>
7579
</Transition>
7680
<DialogContent
7781
ref="dialogContentRef"
7882
v-bind="forwarded"
7983
:class="
8084
cn(
81-
'fixed left-1/2 top-1/2 z-2000 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-0 data-[state=closed]:slide-out-to-top-1/5 data-[state=open]:slide-in-from-left-0 data-[state=open]:slide-in-from-top-1/5 sm:rounded-lg',
85+
'fixed left-1/2 top-1/2 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-0 data-[state=closed]:slide-out-to-top-1/5 data-[state=open]:slide-in-from-left-0 data-[state=open]:slide-in-from-top-1/5 sm:rounded-lg',
8286
props.class,
8387
)"
88+
:style="{
89+
zIndex: props.zIndex,
90+
}"
8491
@animationend="emits('animationEnd')"
8592
>
8693
<slot />

src/ui/components/FaModal/dialog/DialogTitle.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const forwardedProps = useForwardProps(delegatedProps)
1717
v-bind="forwardedProps"
1818
:class="
1919
cn(
20-
'text-lg font-semibold tracking-tight',
20+
'text-lg font-semibold leading-none tracking-tight',
2121
props.class,
2222
)
2323
"

src/ui/components/FaModal/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Modal from './index.vue'
55
export interface ModalProps {
66
id?: string
77
modelValue?: boolean
8+
zIndex?: number
89
title?: string
910
description?: string
1011
icon?: 'info' | 'success' | 'warning' | 'error'

src/ui/components/FaModal/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const props = withDefaults(
2020
defineProps<ModalProps>(),
2121
{
2222
modelValue: false,
23+
zIndex: 2000,
2324
loading: false,
2425
closable: true,
2526
maximize: false,
@@ -214,6 +215,7 @@ function handleAnimationEnd() {
214215
ref="dialogContentRef"
215216
:modal-id="modalId"
216217
:open="isOpen"
218+
:z-index="props.zIndex"
217219
:closable="props.closable"
218220
:overlay="props.overlay"
219221
:overlay-blur="props.overlayBlur"

0 commit comments

Comments
 (0)