This repository was archived by the owner on Jan 9, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ export default defineComponent({
112
112
computed (() => props .modelValue ),
113
113
)
114
114
115
- const frame = ref (null )
115
+ const frame = ref < Element | null > (null )
116
116
const { activeZIndex } = useStackable ({
117
117
activeElSelector: ' .q-dialog-frame--active' ,
118
118
stackMinZIndex: 200 ,
@@ -123,7 +123,7 @@ export default defineComponent({
123
123
const classes = computed (() => [
124
124
' q-dialog-frame' ,
125
125
{
126
- ' q-dialog-frame--active' : isActive ,
126
+ ' q-dialog-frame--active' : isActive . value ,
127
127
},
128
128
])
129
129
Original file line number Diff line number Diff line change 1
- import { computed , Ref , ComputedRef } from 'vue'
1
+ import {
2
+ computed , Ref , ComputedRef ,
3
+ } from 'vue'
2
4
3
5
// helpers
4
6
import { getZIndex } from '@/gitart-vue-dialog/helper'
@@ -7,7 +9,7 @@ interface IUseStackableParams {
7
9
activeElSelector : string
8
10
stackMinZIndex : number
9
11
isActive : Ref < boolean >
10
- content : any
12
+ content : Ref < Element | null >
11
13
}
12
14
13
15
export const useStackable : ( param : IUseStackableParams ) => { activeZIndex : ComputedRef < number > } = ( {
@@ -16,20 +18,28 @@ export const useStackable: (param: IUseStackableParams) => {activeZIndex: Comput
16
18
isActive,
17
19
content,
18
20
} ) => {
19
- const getMaxZIndex = ( ) => {
21
+ const getMaxZIndex = ( exclude : Element [ ] = [ ] ) => {
20
22
const zIndexes = [ stackMinZIndex ]
21
23
22
24
const activeElements = document . querySelectorAll ( activeElSelector )
23
25
24
26
for ( let index = 0 ; index < activeElements . length ; index ++ ) {
25
- zIndexes . push ( getZIndex ( activeElements [ index ] ) )
27
+ if ( ! exclude . includes ( activeElements [ index ] ) ) {
28
+ zIndexes . push ( getZIndex ( activeElements [ index ] ) )
29
+ }
26
30
}
27
31
28
32
return Math . max ( ...zIndexes )
29
33
}
30
34
31
35
const activeZIndex = computed ( ( ) => {
32
- const index = isActive . value ? getMaxZIndex ( ) + 2 : getZIndex ( content . value )
36
+ if ( ! content . value ) {
37
+ return 0
38
+ }
39
+
40
+ const index = isActive . value
41
+ ? getMaxZIndex ( [ content . value ] ) + 2
42
+ : getZIndex ( content . value )
33
43
34
44
if ( index === null ) {
35
45
return 0
You can’t perform that action at this time.
0 commit comments