Browse Source

feat: scroll to the last column after creating a new column

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5805/head
Pranav C 2 years ago
parent
commit
42409a0a7d
  1. 14
      packages/nc-gui/components/smartsheet/Grid.vue

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

@ -776,9 +776,17 @@ eventBus.on(async (event, payload) => {
} }
}) })
const closeAddColumnDropdown = () => { const closeAddColumnDropdown = (scrollToLastAddNewRowHeader = false) => {
columnOrder.value = null columnOrder.value = null
addColumnDropdown.value = false addColumnDropdown.value = false
if (scrollToLastAddNewRowHeader) {
setTimeout(() => {
const lastAddNewRowHeader = tableHead.value?.querySelector('th:last-child')
if (lastAddNewRowHeader) {
lastAddNewRowHeader.scrollIntoView({ behavior: 'smooth' })
}
}, 200)
}
} }
const confirmDeleteRow = (row: number) => { const confirmDeleteRow = (row: number) => {
@ -889,8 +897,8 @@ function addEmptyRow(row?: number) {
<SmartsheetColumnEditOrAddProvider <SmartsheetColumnEditOrAddProvider
v-if="addColumnDropdown" v-if="addColumnDropdown"
:column-position="columnOrder" :column-position="columnOrder"
@submit="closeAddColumnDropdown" @submit="closeAddColumnDropdown(true)"
@cancel="closeAddColumnDropdown" @cancel="closeAddColumnDropdown()"
@click.stop @click.stop
@keydown.stop @keydown.stop
/> />

Loading…
Cancel
Save