|
@@ -12,6 +12,7 @@ function PaginationWrapper(props) {
|
|
|
const paginationNumbers = {};
|
|
const paginationNumbers = {};
|
|
|
const { paginationStart } = paginationNumbers;
|
|
const { paginationStart } = paginationNumbers;
|
|
|
const { maxViewPageNum } = paginationNumbers;
|
|
const { maxViewPageNum } = paginationNumbers;
|
|
|
|
|
+ const { totalPage } = paginationNumbers;
|
|
|
// super(props);
|
|
// super(props);
|
|
|
|
|
|
|
|
// this.state = {
|
|
// this.state = {
|
|
@@ -119,15 +120,15 @@ function PaginationWrapper(props) {
|
|
|
* ex. << < 1 2 3 > >>
|
|
* ex. << < 1 2 3 > >>
|
|
|
* this function set > & >>
|
|
* this function set > & >>
|
|
|
*/
|
|
*/
|
|
|
- const generateNextLast = useCallback((activePage, totalPage) => {
|
|
|
|
|
|
|
+ const generateNextLast = useCallback(() => {
|
|
|
const paginationItems = [];
|
|
const paginationItems = [];
|
|
|
if (totalPage !== activePage) {
|
|
if (totalPage !== activePage) {
|
|
|
paginationItems.push(
|
|
paginationItems.push(
|
|
|
<PaginationItem key="painationItemNext">
|
|
<PaginationItem key="painationItemNext">
|
|
|
- <PaginationLink next onClick={() => { return props.changePage(activePage + 1) }} />
|
|
|
|
|
|
|
+ <PaginationLink next onClick={() => { return changePage(activePage + 1) }} />
|
|
|
</PaginationItem>,
|
|
</PaginationItem>,
|
|
|
<PaginationItem key="painationItemLast">
|
|
<PaginationItem key="painationItemLast">
|
|
|
- <PaginationLink last onClick={() => { return props.changePage(totalPage) }} />
|
|
|
|
|
|
|
+ <PaginationLink last onClick={() => { return changePage(totalPage) }} />
|
|
|
</PaginationItem>,
|
|
</PaginationItem>,
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
@@ -142,8 +143,7 @@ function PaginationWrapper(props) {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
return paginationItems;
|
|
return paginationItems;
|
|
|
-
|
|
|
|
|
- }, []);
|
|
|
|
|
|
|
+ }, [activePage, changePage, totalPage]);
|
|
|
|
|
|
|
|
const getListClassName = useMemo(() => {
|
|
const getListClassName = useMemo(() => {
|
|
|
const listClassNames = [];
|
|
const listClassNames = [];
|
|
@@ -158,18 +158,12 @@ function PaginationWrapper(props) {
|
|
|
return listClassNames.join(' ');
|
|
return listClassNames.join(' ');
|
|
|
}, [align]);
|
|
}, [align]);
|
|
|
|
|
|
|
|
- const paginationItems = [];
|
|
|
|
|
-
|
|
|
|
|
- const totalPage = paginationNumbers.totalPage;
|
|
|
|
|
- const nextLastItems = generateNextLast(activePage, totalPage);
|
|
|
|
|
- paginationItems.push(nextLastItems);
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<React.Fragment>
|
|
<React.Fragment>
|
|
|
<Pagination size={props.size} listClassName={getListClassName}>
|
|
<Pagination size={props.size} listClassName={getListClassName}>
|
|
|
{generateFirstPrev()}
|
|
{generateFirstPrev()}
|
|
|
{generatePaginations()}
|
|
{generatePaginations()}
|
|
|
- {paginationItems}
|
|
|
|
|
|
|
+ {generateNextLast()}
|
|
|
</Pagination>
|
|
</Pagination>
|
|
|
</React.Fragment>
|
|
</React.Fragment>
|
|
|
);
|
|
);
|