js-kompo-utils 1.0.26 → 1.0.27
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/components/VlSelect.vue +23 -10
- package/package.json +1 -1
package/components/VlSelect.vue
CHANGED
|
@@ -214,15 +214,16 @@ export default {
|
|
|
214
214
|
window.addEventListener('resize', this._onResize, { passive: true })
|
|
215
215
|
|
|
216
216
|
if (window.visualViewport) {
|
|
217
|
-
this.
|
|
217
|
+
this._onViewportScroll = () => {
|
|
218
218
|
if (this._rafId) return
|
|
219
219
|
this._rafId = requestAnimationFrame(() => {
|
|
220
220
|
this._rafId = null
|
|
221
|
-
this.
|
|
221
|
+
this.trackPosition()
|
|
222
222
|
})
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
window.visualViewport.addEventListener('scroll', this.
|
|
224
|
+
this._onViewportResize = () => this.refresh()
|
|
225
|
+
window.visualViewport.addEventListener('scroll', this._onViewportScroll)
|
|
226
|
+
window.visualViewport.addEventListener('resize', this._onViewportResize)
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
const opts = this.$refs.selectOptions
|
|
@@ -243,10 +244,17 @@ export default {
|
|
|
243
244
|
})
|
|
244
245
|
if (anchor) this._anchorObserver.observe(anchor)
|
|
245
246
|
}
|
|
246
|
-
|
|
247
|
+
const inOverlay = !!(anchor && anchor.closest('.kompoModal, .kompoDrawer, .vl-sidebar-l'))
|
|
248
|
+
if (inOverlay && typeof IntersectionObserver !== 'undefined' && anchor) {
|
|
249
|
+
let intersectionInitialised = false
|
|
247
250
|
this._anchorIntersection = new IntersectionObserver((entries) => {
|
|
248
251
|
const entry = entries[entries.length - 1]
|
|
249
|
-
if (entry
|
|
252
|
+
if (!entry) return
|
|
253
|
+
if (!intersectionInitialised) {
|
|
254
|
+
intersectionInitialised = true
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
if (entry.intersectionRatio === 0) this.blur()
|
|
250
258
|
}, { threshold: 0 })
|
|
251
259
|
this._anchorIntersection.observe(anchor)
|
|
252
260
|
}
|
|
@@ -261,10 +269,15 @@ export default {
|
|
|
261
269
|
}
|
|
262
270
|
window.removeEventListener('scroll', this._onScroll, true)
|
|
263
271
|
window.removeEventListener('resize', this._onResize)
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
272
|
+
if (window.visualViewport) {
|
|
273
|
+
if (this._onViewportScroll) {
|
|
274
|
+
window.visualViewport.removeEventListener('scroll', this._onViewportScroll)
|
|
275
|
+
this._onViewportScroll = null
|
|
276
|
+
}
|
|
277
|
+
if (this._onViewportResize) {
|
|
278
|
+
window.visualViewport.removeEventListener('resize', this._onViewportResize)
|
|
279
|
+
this._onViewportResize = null
|
|
280
|
+
}
|
|
268
281
|
}
|
|
269
282
|
if (this._panelObserver) {
|
|
270
283
|
this._panelObserver.disconnect()
|