Browse Source

fix(gui): scroll to view only if required

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4033/head
Pranav C 2 years ago
parent
commit
4584655410
  1. 21
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 1
      packages/nc-gui/composables/useMultiSelect/index.ts

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

@ -83,6 +83,7 @@ const contextMenuTarget = ref<{ row: number; col: number } | null>(null)
const expandedFormDlg = ref(false) const expandedFormDlg = ref(false)
const expandedFormRow = ref<Row>() const expandedFormRow = ref<Row>()
const expandedFormRowState = ref<Record<string, any>>() const expandedFormRowState = ref<Record<string, any>>()
const tbodyEl = ref<HTMLElement>()
const { const {
isLoading, isLoading,
@ -115,8 +116,8 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange
// scroll into the active cell // scroll into the active cell
td.scrollIntoView({ td.scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
block: 'end', block: 'nearest',
inline: 'end', inline: 'nearest',
}) })
} }
}, },
@ -363,22 +364,6 @@ watch(
}, },
{ immediate: true }, { immediate: true },
) )
const tbodyEl = ref<HTMLElement>()
// watch([() => selected.row, () => selected.col], ([row, col]) => {
// if (row !== null && col !== null) {
// // get active cell
// const td = tbodyEl.value?.querySelectorAll('tr')[row]?.querySelectorAll('td')[col + 1]
// if (!td) return
// // scroll into the active cell
// td.scrollIntoView({
// behavior: 'smooth',
// block: 'end',
// inline: 'end',
// })
// }
// })
</script> </script>
<template> <template>

1
packages/nc-gui/composables/useMultiSelect/index.ts

@ -40,7 +40,6 @@ export function useMultiSelect(
clearRangeRows() clearRangeRows()
selected.row = row selected.row = row
selected.col = col selected.col = col
scrollToActiveCell?.()
} }
function selectBlock(row: number, col: number) { function selectBlock(row: number, col: number) {

Loading…
Cancel
Save