|
1 | 1 | import type { Fn } from '@vueuse/shared' |
2 | 2 | import type { ComponentPublicInstance, MaybeRefOrGetter, VNode } from 'vue' |
3 | 3 | import type { ConfigurableWindow } from '../_configurable' |
4 | | -import type { MaybeElementRef } from '../unrefElement' |
| 4 | +import type { MaybeComputedElementRef, MaybeElementRef } from '../unrefElement' |
5 | 5 | import { isIOS, noop } from '@vueuse/shared' |
6 | 6 | import { toValue } from 'vue' |
7 | 7 | import { defaultWindow } from '../_configurable' |
@@ -58,22 +58,22 @@ let _iOSWorkaround = false |
58 | 58 | export function onClickOutside< |
59 | 59 | T extends OnClickOutsideOptions, |
60 | 60 | >( |
61 | | - target: MaybeElementRef, |
| 61 | + target: MaybeComputedElementRef, |
62 | 62 | handler: OnClickOutsideHandler<T>, |
63 | 63 | options?: T |
64 | 64 | ): Fn |
65 | 65 |
|
66 | 66 | export function onClickOutside< |
67 | 67 | T extends OnClickOutsideOptions<true>, |
68 | 68 | >( |
69 | | - target: MaybeElementRef, |
| 69 | + target: MaybeComputedElementRef, |
70 | 70 | handler: OnClickOutsideHandler<T>, |
71 | 71 | options: T |
72 | 72 | ): OnClickOutsideControlsReturn |
73 | 73 |
|
74 | 74 | // Implementation |
75 | 75 | export function onClickOutside( |
76 | | - target: MaybeElementRef, |
| 76 | + target: MaybeComputedElementRef, |
77 | 77 | handler: OnClickOutsideHandler, |
78 | 78 | options: OnClickOutsideOptions<boolean> = {}, |
79 | 79 | ) { |
@@ -116,12 +116,12 @@ export function onClickOutside( |
116 | 116 | * Determines if the given target has multiple root elements. |
117 | 117 | * Referenced from: https://github.com/vuejs/test-utils/blob/ccb460be55f9f6be05ab708500a41ec8adf6f4bc/src/vue-wrapper.ts#L21 |
118 | 118 | */ |
119 | | - function hasMultipleRoots(target: MaybeElementRef): boolean { |
| 119 | + function hasMultipleRoots(target: MaybeComputedElementRef): boolean { |
120 | 120 | const vm = toValue(target) as ComponentPublicInstance |
121 | 121 | return vm && vm.$.subTree.shapeFlag === 16 |
122 | 122 | } |
123 | 123 |
|
124 | | - function checkMultipleRoots(target: MaybeElementRef, event: Event): boolean { |
| 124 | + function checkMultipleRoots(target: MaybeComputedElementRef, event: Event): boolean { |
125 | 125 | const vm = toValue(target) as ComponentPublicInstance |
126 | 126 | const children = vm.$.subTree && vm.$.subTree.children |
127 | 127 |
|
|
0 commit comments