@dataloop-ai/components 0.16.39 → 0.16.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -268,9 +268,12 @@ export default defineComponent({
|
|
|
268
268
|
})
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
registerTick(
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
registerTick(
|
|
272
|
+
() => {
|
|
273
|
+
updatePosition()
|
|
274
|
+
},
|
|
275
|
+
{ continuous: true }
|
|
276
|
+
)
|
|
274
277
|
|
|
275
278
|
registerTimeout(() => {
|
|
276
279
|
// required in order to avoid the "double-tap needed" issue
|
|
@@ -357,7 +360,7 @@ export default defineComponent({
|
|
|
357
360
|
})
|
|
358
361
|
}
|
|
359
362
|
|
|
360
|
-
async
|
|
363
|
+
const updatePosition = async () => {
|
|
361
364
|
const el = innerRef.value
|
|
362
365
|
|
|
363
366
|
if (el === null || anchorEl.value === null) {
|
|
@@ -367,6 +370,7 @@ export default defineComponent({
|
|
|
367
370
|
const isAnchorElVisible = await CheckAnchorElVisiblity(
|
|
368
371
|
anchorEl.value
|
|
369
372
|
)
|
|
373
|
+
|
|
370
374
|
if (!isAnchorElVisible) {
|
|
371
375
|
hide()
|
|
372
376
|
return
|
package/src/hooks/use-tick.ts
CHANGED
|
@@ -1,32 +1,52 @@
|
|
|
1
1
|
import { nextTick, onBeforeUnmount } from 'vue-demi'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* registerTick(fn)
|
|
3
|
+
/**
|
|
4
|
+
* @description a tick hook that allows you to register a function to be called on the next tick or on the next animation frame.
|
|
5
|
+
* @returns {Object} registerTick, removeTick
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
7
|
export default function () {
|
|
10
|
-
let tickFn: Function |
|
|
8
|
+
let tickFn: Function | null = null
|
|
9
|
+
let animationFrameId: number | null = null
|
|
11
10
|
|
|
12
11
|
onBeforeUnmount(() => {
|
|
13
|
-
|
|
12
|
+
removeTick()
|
|
14
13
|
})
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const registerTick = (
|
|
16
|
+
fn: Function,
|
|
17
|
+
options: { continuous?: boolean } = {}
|
|
18
|
+
) => {
|
|
19
|
+
tickFn = fn
|
|
20
|
+
|
|
21
|
+
const { continuous } = options
|
|
19
22
|
|
|
23
|
+
if (continuous) {
|
|
24
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
25
|
+
if (tickFn === fn) {
|
|
26
|
+
tickFn()
|
|
27
|
+
registerTick(fn, { continuous })
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
} else {
|
|
20
31
|
nextTick(() => {
|
|
21
32
|
if (tickFn === fn) {
|
|
22
33
|
tickFn()
|
|
23
|
-
tickFn =
|
|
34
|
+
tickFn = null
|
|
24
35
|
}
|
|
25
36
|
})
|
|
26
|
-
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
27
39
|
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
const removeTick = () => {
|
|
41
|
+
tickFn = null
|
|
42
|
+
if (animationFrameId) {
|
|
43
|
+
cancelAnimationFrame(animationFrameId)
|
|
30
44
|
}
|
|
45
|
+
animationFrameId = null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
registerTick,
|
|
50
|
+
removeTick
|
|
31
51
|
}
|
|
32
52
|
}
|