UNPKG

@mescius/dspdfviewer

Version:
93 lines (92 loc) 2.76 kB
//@ts-ignore import React, { Component } from 'react'; //@ts-ignore import { ViewerStatus } from '@grapecity/viewer-core'; import GcPdfViewer from '../../GcPdfViewer'; /** * Props for the NavigationControl component */ export type NavigationControlProps = { /** * The PDF viewer instance */ viewer: GcPdfViewer; /** * Optional CSS class name for the root element */ className?: string; }; /** * State of the NavigationControl component */ export type NavigationControlModel = { disabled?: boolean; version?: number; status: ViewerStatus; fullscreen: boolean; hasView: boolean; canGoBackward: boolean; canGoForward: boolean; canRefresh: boolean; pageCount: number; pageIndex: number; }; /** * Navigation control component for PDF viewer with customizable buttons, keyboard shortcuts, * and page navigation features. */ export declare class NavigationControl extends Component<NavigationControlProps, NavigationControlModel> { private _unregisterViewerStateChange?; /** * Default navigation control options */ private static defaultOptions; private _outerElement; constructor(props: NavigationControlProps); componentDidMount(): void; componentWillUnmount(): void; /** * Gets the merged navigation options from viewer options and defaults */ private get navigationOptions(); /** * Formats the page counter text according to the specified format */ private getPageCounterText; /** * Handles viewer state changes and updates component state accordingly */ private onStateChange; getActualStateFromViewer(): { status: ViewerStatus; fullscreen: boolean; hasView: boolean; canRefresh: boolean; canGoBackward: boolean; canGoForward: boolean; pageIndex: number; pageCount: number; }; /** * Handles navigation button clicks with support for Ctrl+click to jump to first/last page */ private handleNavigationClick; //@ts-ignore //@ts-ignore render(): React.JSX.Element; private _updateButtonSizing; private onPageInputFocus; private navigateTo; private onPageInputBlur; /** * Handles keyboard events in the page input field with smarter arrow key navigation * - Enter: Navigates to the entered page * - ArrowRight: Next page (only when cursor at end) * - ArrowLeft: Previous page (only when cursor at start) * - ArrowUp/Down: Next/Previous page (always) * - Home: First page * - End: Last page * - Escape: Cancel input */ private onPageInputPress; }