|
|
@ -151,10 +151,39 @@ const onContextmenu = (e: MouseEvent) => { |
|
|
|
e.stopPropagation() |
|
|
|
e.stopPropagation() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const intersected = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let intersectionObserver = $ref<IntersectionObserver>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const elementToObserve = $ref<Element>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// load the cell only when it is in the viewport |
|
|
|
|
|
|
|
function initIntersectionObserver() { |
|
|
|
|
|
|
|
intersectionObserver = new IntersectionObserver((entries) => { |
|
|
|
|
|
|
|
entries.forEach((entry) => { |
|
|
|
|
|
|
|
if (entry.isIntersecting) { |
|
|
|
|
|
|
|
intersected.value = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// observe the cell when it is mounted |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
|
|
initIntersectionObserver() |
|
|
|
|
|
|
|
intersectionObserver?.observe(elementToObserve!) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// disconnect the observer when the cell is unmounted |
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
|
|
|
|
intersectionObserver?.disconnect() |
|
|
|
|
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div |
|
|
|
<div |
|
|
|
|
|
|
|
ref="elementToObserve" |
|
|
|
class="nc-cell w-full h-full relative" |
|
|
|
class="nc-cell w-full h-full relative" |
|
|
|
:class="[ |
|
|
|
:class="[ |
|
|
|
`nc-cell-${(column?.uidt || 'default').toLowerCase()}`, |
|
|
|
`nc-cell-${(column?.uidt || 'default').toLowerCase()}`, |
|
|
@ -167,6 +196,7 @@ const onContextmenu = (e: MouseEvent) => { |
|
|
|
@contextmenu="onContextmenu" |
|
|
|
@contextmenu="onContextmenu" |
|
|
|
> |
|
|
|
> |
|
|
|
<template v-if="column"> |
|
|
|
<template v-if="column"> |
|
|
|
|
|
|
|
<template v-if="intersected"> |
|
|
|
<LazyCellTextArea v-if="isTextArea(column)" v-model="vModel" /> |
|
|
|
<LazyCellTextArea v-if="isTextArea(column)" v-model="vModel" /> |
|
|
|
<LazyCellGeoData v-else-if="isGeoData(column)" v-model="vModel" /> |
|
|
|
<LazyCellGeoData v-else-if="isGeoData(column)" v-model="vModel" /> |
|
|
|
<LazyCellCheckbox v-else-if="isBoolean(column, abstractType)" v-model="vModel" /> |
|
|
|
<LazyCellCheckbox v-else-if="isBoolean(column, abstractType)" v-model="vModel" /> |
|
|
@ -197,6 +227,7 @@ const onContextmenu = (e: MouseEvent) => { |
|
|
|
@dblclick.stop.prevent |
|
|
|
@dblclick.stop.prevent |
|
|
|
/> |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|