File tree Expand file tree Collapse file tree 3 files changed +80
-7
lines changed
Expand file tree Collapse file tree 3 files changed +80
-7
lines changed Original file line number Diff line number Diff line change 1+ import styled from "styled-components" ;
2+ import { Pagination } from "antd" ;
3+
4+ const PaginationLayout = styled ( Pagination ) `
5+ display: flex;
6+ justify-content: center;
7+ margin-top: 40px;
8+ margin-bottom: 20px;
9+ ` ;
10+
11+ interface PaginationCompProps {
12+ setCurrentPage : ( page : number ) => void ;
13+ setPageSize : ( size : number ) => void ;
14+ currentPage : number ;
15+ pageSize : number ;
16+ total : number ;
17+ }
18+
19+ const PaginationComp = ( props : PaginationCompProps ) => {
20+ const {
21+ setCurrentPage,
22+ setPageSize,
23+ currentPage,
24+ pageSize,
25+ total,
26+ } = props ;
27+
28+ const handlePageChange = ( page : number , pageSize : number | undefined ) => {
29+ if ( setCurrentPage ) {
30+ setCurrentPage ( page ) ;
31+ }
32+ } ;
33+
34+ const handlePageSizeChange = ( current : number , size : number ) => {
35+ if ( setPageSize ) {
36+ setPageSize ( size ) ;
37+ }
38+ } ;
39+
40+ return (
41+ < PaginationLayout
42+ current = { currentPage }
43+ pageSize = { pageSize }
44+ onChange = { handlePageChange }
45+ onShowSizeChange = { handlePageSizeChange }
46+ total = { total }
47+ showSizeChanger
48+ />
49+ ) ;
50+ } ;
51+
52+ export default PaginationComp ;
Original file line number Diff line number Diff line change 11import { FolderApi } from "@lowcoder-ee/api/folderApi" ;
2- import { FetchFolderElementsPaginationPayload } from "@lowcoder-ee/redux/reduxActions/folderActions" ;
3- import {
4- FetchApplicationElementsPaginationPayload ,
5- } from "@lowcoder-ee/redux/reduxActions/applicationActions" ;
62import ApplicationApi from "@lowcoder-ee/api/applicationApi" ;
3+ import { fetchAppRequestType , fetchFolderRequestType } from "@lowcoder-ee/util/pagination/type" ;
74
8- export const fetchFolderElements = async ( request : FetchFolderElementsPaginationPayload ) => {
5+
6+
7+ export const fetchFolderElements = async ( request : fetchFolderRequestType ) => {
98 try {
109 const response = await FolderApi . fetchFolderElementsPagination ( request ) ;
1110 return {
@@ -23,7 +22,7 @@ export const fetchFolderElements = async (request: FetchFolderElementsPagination
2322}
2423
2524
26- export const fetchApplicationElements = async ( request : FetchApplicationElementsPaginationPayload ) => {
25+ export const fetchApplicationElements = async ( request : fetchAppRequestType ) => {
2726 try {
2827 const response = await ApplicationApi . fetchAllApplicationsPagination ( request ) ;
2928 return {
Original file line number Diff line number Diff line change @@ -11,4 +11,26 @@ export const ApplicationPaginationType: ApplicationType = {
1111 4 : "FOLDER" ,
1212 6 : "MOBILETABLAYOUT" ,
1313 7 : "NAVIGATION" ,
14- } ;
14+ } ;
15+
16+ export interface fetchAppRequestType {
17+ pageNum ?: number ;
18+ pageSize ?: number ;
19+ name ?: string ;
20+ applicationType ?: number ;
21+ }
22+
23+ export interface fetchFolderRequestType {
24+ pageNum ?: number ;
25+ pageSize ?: number ;
26+ name ?: string ;
27+ applicationType ?: string ;
28+ }
29+
30+ export interface GenericApiPaginationResponse < T > {
31+ total : number ;
32+ success : boolean ;
33+ code : number ;
34+ message : string ;
35+ data : T ;
36+ }
You can’t perform that action at this time.
0 commit comments