Comparing version 0.4.20 to 0.4.21
@@ -195,5 +195,10 @@ /* eslint-disable no-void */ | ||
return; | ||
if (isHideByVShow(entry.target)) | ||
return; | ||
const { value: ft } = finweckTreeRef; | ||
const index = keyIndexMapRef.value.get(key); | ||
const height = entry.target.offsetHeight; | ||
const previousHeight = ft.get(index); | ||
const height = entry.contentRect.height; | ||
if (height === previousHeight) | ||
return; | ||
// height offset based on itemSize | ||
@@ -209,3 +214,3 @@ // used when rebuild the finweck tree | ||
// delta height based on finweck tree data | ||
const delta = height - ft.get(index); | ||
const delta = height - previousHeight; | ||
if (delta === 0) | ||
@@ -226,2 +231,8 @@ return; | ||
function handleListResize(entry) { | ||
// List is HTMLElement | ||
if (isHideByVShow(entry.target)) | ||
return; | ||
// If height is same, return | ||
if (entry.contentRect.height === listHeightRef.value) | ||
return; | ||
listHeightRef.value = entry.contentRect.height; | ||
@@ -244,2 +255,11 @@ const { onResize } = props; | ||
} | ||
function isHideByVShow(el) { | ||
let cursor = el; | ||
while (cursor !== null) { | ||
if (cursor.style.display === 'none') | ||
return true; | ||
cursor = cursor.parentElement; | ||
} | ||
return false; | ||
} | ||
return { | ||
@@ -291,6 +311,3 @@ listHeight: listHeightRef, | ||
return h('div', mergeProps(this.$attrs, { | ||
class: [ | ||
'v-vl', | ||
this.showScrollbar && 'v-vl--show-scrollbar' | ||
], | ||
class: ['v-vl', this.showScrollbar && 'v-vl--show-scrollbar'], | ||
onScroll: this.handleListScroll, | ||
@@ -310,6 +327,9 @@ onWheel: this.onWheel, | ||
}, this.visibleItemsProps), { | ||
default: () => this.viewportItems.map(item => { | ||
default: () => this.viewportItems.map((item) => { | ||
const key = item[keyField]; | ||
const index = keyToIndex.get(key); | ||
const itemVNode = this.$slots.default({ item, index })[0]; | ||
const itemVNode = this.$slots.default({ | ||
item, | ||
index | ||
})[0]; | ||
if (itemResizable) { | ||
@@ -316,0 +336,0 @@ return h(VResizeObserver, { |
@@ -200,5 +200,10 @@ "use strict"; | ||
return; | ||
if (isHideByVShow(entry.target)) | ||
return; | ||
const { value: ft } = finweckTreeRef; | ||
const index = keyIndexMapRef.value.get(key); | ||
const height = entry.target.offsetHeight; | ||
const previousHeight = ft.get(index); | ||
const height = entry.contentRect.height; | ||
if (height === previousHeight) | ||
return; | ||
// height offset based on itemSize | ||
@@ -214,3 +219,3 @@ // used when rebuild the finweck tree | ||
// delta height based on finweck tree data | ||
const delta = height - ft.get(index); | ||
const delta = height - previousHeight; | ||
if (delta === 0) | ||
@@ -231,2 +236,8 @@ return; | ||
function handleListResize(entry) { | ||
// List is HTMLElement | ||
if (isHideByVShow(entry.target)) | ||
return; | ||
// If height is same, return | ||
if (entry.contentRect.height === listHeightRef.value) | ||
return; | ||
listHeightRef.value = entry.contentRect.height; | ||
@@ -249,2 +260,11 @@ const { onResize } = props; | ||
} | ||
function isHideByVShow(el) { | ||
let cursor = el; | ||
while (cursor !== null) { | ||
if (cursor.style.display === 'none') | ||
return true; | ||
cursor = cursor.parentElement; | ||
} | ||
return false; | ||
} | ||
return { | ||
@@ -296,6 +316,3 @@ listHeight: listHeightRef, | ||
return (0, vue_1.h)('div', (0, vue_1.mergeProps)(this.$attrs, { | ||
class: [ | ||
'v-vl', | ||
this.showScrollbar && 'v-vl--show-scrollbar' | ||
], | ||
class: ['v-vl', this.showScrollbar && 'v-vl--show-scrollbar'], | ||
onScroll: this.handleListScroll, | ||
@@ -315,6 +332,9 @@ onWheel: this.onWheel, | ||
}, this.visibleItemsProps), { | ||
default: () => this.viewportItems.map(item => { | ||
default: () => this.viewportItems.map((item) => { | ||
const key = item[keyField]; | ||
const index = keyToIndex.get(key); | ||
const itemVNode = this.$slots.default({ item, index })[0]; | ||
const itemVNode = this.$slots.default({ | ||
item, | ||
index | ||
})[0]; | ||
if (itemResizable) { | ||
@@ -321,0 +341,0 @@ return (0, vue_1.h)(src_1.default, { |
{ | ||
"name": "vueuc", | ||
"version": "0.4.20", | ||
"version": "0.4.21", | ||
"description": "Util Components for Vue", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206642
5381