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 1
1
import { 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" ;
6
2
import ApplicationApi from "@lowcoder-ee/api/applicationApi" ;
3
+ import { fetchAppRequestType , fetchFolderRequestType } from "@lowcoder-ee/util/pagination/type" ;
7
4
8
- export const fetchFolderElements = async ( request : FetchFolderElementsPaginationPayload ) => {
5
+
6
+
7
+ export const fetchFolderElements = async ( request : fetchFolderRequestType ) => {
9
8
try {
10
9
const response = await FolderApi . fetchFolderElementsPagination ( request ) ;
11
10
return {
@@ -23,7 +22,7 @@ export const fetchFolderElements = async (request: FetchFolderElementsPagination
23
22
}
24
23
25
24
26
- export const fetchApplicationElements = async ( request : FetchApplicationElementsPaginationPayload ) => {
25
+ export const fetchApplicationElements = async ( request : fetchAppRequestType ) => {
27
26
try {
28
27
const response = await ApplicationApi . fetchAllApplicationsPagination ( request ) ;
29
28
return {
Original file line number Diff line number Diff line change @@ -11,4 +11,26 @@ export const ApplicationPaginationType: ApplicationType = {
11
11
4 : "FOLDER" ,
12
12
6 : "MOBILETABLAYOUT" ,
13
13
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