Browse Source

feat: avoid click outside event on scrollbar click

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5896/head
mertmit 1 year ago
parent
commit
7ae97d551f
  1. 20
      packages/nc-gui/components/smartsheet/Grid.vue

20
packages/nc-gui/components/smartsheet/Grid.vue

@ -99,6 +99,8 @@ const contextMenu = computed({
})
const contextMenuClosing = ref(false)
const scrolling = ref(false)
const bulkUpdateDlg = ref(false)
const routeQuery = $computed(() => route.query as Record<string, string>)
@ -660,6 +662,11 @@ const smartTable = ref(null)
/** On clicking outside of table reset active cell */
onClickOutside(tableBodyEl, (e) => {
// do nothing if mousedown on the scrollbar (scrolling)
if (scrolling.value) {
return
}
// do nothing if context menu was open
if (contextMenu.value) return
@ -936,6 +943,19 @@ watch(
useEventListener(gridWrapper, 'scroll', () => {
refreshFillHandle()
})
useEventListener(document, 'mousedown', (e) => {
if (e.offsetX > (e.target as HTMLElement)?.clientWidth || e.offsetY > (e.target as HTMLElement)?.clientHeight) {
scrolling.value = true
}
})
useEventListener(document, 'mouseup', () => {
// wait for click event to finish before setting scrolling to false
setTimeout(() => {
scrolling.value = false
}, 100)
})
</script>
<template>

Loading…
Cancel
Save