bc518174
王天杨
提交两个项目文件
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
import * as React from 'react';
export interface UsePaginationProps {
/**
* Number of always visible pages at the beginning and end.
* @default 1
*/
boundaryCount?: number;
/**
* The name of the component where this hook is used.
*/
componentName?: string;
/**
* The total number of pages.
* @default 1
*/
count?: number;
/**
* The page selected by default when the component is uncontrolled.
* @default 1
*/
defaultPage?: number;
/**
* If `true`, the component is disabled.
* @default false
*/
disabled?: boolean;
/**
* If `true`, hide the next-page button.
* @default false
*/
hideNextButton?: boolean;
/**
* If `true`, hide the previous-page button.
* @default false
*/
hidePrevButton?: boolean;
/**
* Callback fired when the page is changed.
*
* @param {React.ChangeEvent<unknown>} event The event source of the callback.
* @param {number} page The page selected.
*/
onChange?: (event: React.ChangeEvent<unknown>, page: number) => void;
/**
* The current page. Unlike `TablePagination`, which starts numbering from `0`, this pagination starts from `1`.
*/
page?: number;
/**
* If `true`, show the first-page button.
* @default false
*/
showFirstButton?: boolean;
/**
* If `true`, show the last-page button.
* @default false
*/
showLastButton?: boolean;
/**
* Number of always visible pages before and after the current page.
* @default 1
*/
siblingCount?: number;
}
export interface UsePaginationItem {
onClick: React.ReactEventHandler;
type: 'page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis';
page: number | null;
selected: boolean;
disabled: boolean;
}
export interface UsePaginationResult {
items: UsePaginationItem[];
}
export default function usePagination(props: UsePaginationProps): UsePaginationResult;
|