js-kompo-utils 1.0.25 → 1.0.26
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 +26 -2
- package/package.json +1 -1
package/components/VlSelect.vue
CHANGED
|
@@ -129,6 +129,10 @@ export default {
|
|
|
129
129
|
optionsKey() {
|
|
130
130
|
this.$nextTick(() => {
|
|
131
131
|
this.teleportOptions()
|
|
132
|
+
if (this._panelObserver && this.$refs.selectOptions) {
|
|
133
|
+
this._panelObserver.disconnect()
|
|
134
|
+
this._panelObserver.observe(this.$refs.selectOptions)
|
|
135
|
+
}
|
|
132
136
|
if (this.isFocused) this.refresh()
|
|
133
137
|
})
|
|
134
138
|
},
|
|
@@ -209,6 +213,18 @@ export default {
|
|
|
209
213
|
window.addEventListener('scroll', this._onScroll, true)
|
|
210
214
|
window.addEventListener('resize', this._onResize, { passive: true })
|
|
211
215
|
|
|
216
|
+
if (window.visualViewport) {
|
|
217
|
+
this._onViewportChange = () => {
|
|
218
|
+
if (this._rafId) return
|
|
219
|
+
this._rafId = requestAnimationFrame(() => {
|
|
220
|
+
this._rafId = null
|
|
221
|
+
this.refresh()
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
window.visualViewport.addEventListener('resize', this._onViewportChange)
|
|
225
|
+
window.visualViewport.addEventListener('scroll', this._onViewportChange)
|
|
226
|
+
}
|
|
227
|
+
|
|
212
228
|
const opts = this.$refs.selectOptions
|
|
213
229
|
const anchor = this.anchorEl()
|
|
214
230
|
if (typeof ResizeObserver !== 'undefined') {
|
|
@@ -245,6 +261,11 @@ export default {
|
|
|
245
261
|
}
|
|
246
262
|
window.removeEventListener('scroll', this._onScroll, true)
|
|
247
263
|
window.removeEventListener('resize', this._onResize)
|
|
264
|
+
if (this._onViewportChange && window.visualViewport) {
|
|
265
|
+
window.visualViewport.removeEventListener('resize', this._onViewportChange)
|
|
266
|
+
window.visualViewport.removeEventListener('scroll', this._onViewportChange)
|
|
267
|
+
this._onViewportChange = null
|
|
268
|
+
}
|
|
248
269
|
if (this._panelObserver) {
|
|
249
270
|
this._panelObserver.disconnect()
|
|
250
271
|
this._panelObserver = null
|
|
@@ -294,8 +315,11 @@ export default {
|
|
|
294
315
|
|
|
295
316
|
this.$nextTick(() => {
|
|
296
317
|
const optsHeight = opts.offsetHeight
|
|
297
|
-
const
|
|
298
|
-
const
|
|
318
|
+
const vv = window.visualViewport
|
|
319
|
+
const viewportHeight = vv ? vv.height : window.innerHeight
|
|
320
|
+
const viewportTop = vv ? vv.offsetTop : 0
|
|
321
|
+
const spaceBelow = (viewportTop + viewportHeight) - rect.bottom
|
|
322
|
+
const spaceAbove = rect.top - viewportTop
|
|
299
323
|
const shouldFlip = this.forceUp || (spaceBelow < optsHeight && spaceAbove > spaceBelow)
|
|
300
324
|
this.flipUp = shouldFlip
|
|
301
325
|
if (shouldFlip) {
|