Files
NapCatQQ/.pnpm-store/v3/files/43/6d85533dfc3d2be85b9ff2b7234b8ebfb0a339fbf5a843a4be245558e3ced97cb553277dff091592d5031b4be822355ed332cf433082f172db58347d68c2d6
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

53 lines
1.3 KiB
Plaintext

declare enum PaginationItemType {
DOTS = "dots",
PREV = "prev",
NEXT = "next"
}
interface UsePaginationProps {
/**
* The total number of pages.
*/
total: number;
/**
* The selected page on initial render.
* @default 1
*/
initialPage?: number;
/**
* The controlled selected page.
*/
page?: number;
/**
* The number of pages to show on each side of the current page.
* @default 1
*/
siblings?: number;
/**
* The number of pages to show at the beginning and end of the pagination.
* @default 1
*/
boundaries?: number;
/**
* If `true`, the range will include "prev" and "next" buttons.
* @default false
*/
showControls?: boolean;
/**
* Callback fired when the page changes.
*/
onChange?: (page: number) => void;
}
type PaginationItemValue = number | PaginationItemType;
declare function usePagination(props: UsePaginationProps): {
range: PaginationItemValue[];
activePage: number;
setPage: (pageNumber: number) => void;
next: () => void;
previous: () => void;
first: () => void;
last: () => void;
};
type UsePaginationReturn = ReturnType<typeof usePagination>;
export { PaginationItemType, type PaginationItemValue, type UsePaginationProps, type UsePaginationReturn, usePagination };