From 3e57a845745fc1fb5e8ed8db481d428bfeeb43fd Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Thu, 2 Nov 2023 07:39:09 +0000 Subject: [PATCH 1/5] fix: Added pagination shortcuts for grid --- .../components/smartsheet/grid/Table.vue | 12 +++ .../smartsheet/grid/usePaginationShortcuts.ts | 73 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 packages/nc-gui/components/smartsheet/grid/usePaginationShortcuts.ts diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vue index e802b92e5f..ce02bff9c7 100644 --- a/packages/nc-gui/components/smartsheet/grid/Table.vue +++ b/packages/nc-gui/components/smartsheet/grid/Table.vue @@ -5,6 +5,7 @@ import type { ColumnReqType, ColumnType, PaginatedType, TableType, ViewType } fr import { UITypes, ViewTypes, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk' import { useColumnDrag } from './useColumnDrag' +import usePaginationShortcuts from './usePaginationShortcuts' import { ActiveViewInj, CellUrlDisableOverlayInj, @@ -187,6 +188,11 @@ const { onDrag, onDragStart, draggedCol, dragColPlaceholderDomRef, toBeDroppedCo gridWrapper, }) +const { onLeft, onRight, onUp, onDown } = usePaginationShortcuts({ + paginationDataRef, + changePage: changePage as any, +}) + // #Variables const addColumnDropdown = ref(false) @@ -1204,6 +1210,12 @@ const loaderText = computed(() => { } } }) + +// Keyboard shortcuts for pagination +onKeyStroke('ArrowLeft', onLeft) +onKeyStroke('ArrowRight', onRight) +onKeyStroke('ArrowUp', onUp) +onKeyStroke('ArrowDown', onDown)