fix: list pagination

This commit is contained in:
jialin
2024-07-16 15:27:54 +08:00
parent 7e06a56c12
commit a27fa9d56c
32 changed files with 2506 additions and 1726 deletions
-4
View File
@@ -1,4 +0,0 @@
.title {
margin: 0 auto;
font-weight: 200;
}
-23
View File
@@ -1,23 +0,0 @@
import { Layout, Row, Typography } from 'antd';
import React from 'react';
import styles from './Guide.less';
interface Props {
name: string;
}
// 脚手架示例组件
const Guide: React.FC<Props> = (props) => {
const { name } = props;
return (
<Layout>
<Row>
<Typography.Title level={3} className={styles.title}>
使 <strong>{name}</strong>
</Typography.Title>
</Row>
</Layout>
);
};
export default Guide;
-2
View File
@@ -1,2 +0,0 @@
import Guide from './Guide';
export default Guide;
+1 -1
View File
@@ -1,7 +1,7 @@
import { GPUStackVersionAtom } from '@/atoms/user';
import { getAtomStorage } from '@/atoms/utils';
import VersionInfo, { modalConfig } from '@/components/version-info';
import externalLinks from '@/config/external-links';
import externalLinks from '@/constants/external-links';
import { useIntl } from '@umijs/max';
import { Button, Modal, Space } from 'antd';
import './index.less';
-39
View File
@@ -1,39 +0,0 @@
.g-polygon {
position: absolute;
opacity: 0.5;
}
.g-polygon-1 {
// 定位代码,容器高宽随意
background: #fe5;
clip-path: polygon(0 10%, 30% 0, 100% 40%, 70% 100%, 20% 90%);
width: 50%;
height: 50%;
}
.g-polygon-2 {
// 定位代码,容器高宽随意
background: #e950d1;
clip-path: polygon(10% 0, 100% 70%, 100% 100%, 20% 90%);
width: 50%;
height: 50%;
}
.g-polygon-3 {
// 定位代码,容器高宽随意
background: rgba(87, 80, 233);
clip-path: polygon(80% 0, 100% 70%, 100% 100%, 20% 90%);
width: 50%;
height: 50%;
}
.g-bg::before {
content: '';
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
backdrop-filter: blur(150px);
z-index: 1;
}
-13
View File
@@ -1,13 +0,0 @@
import './index.less';
const GlassBg = () => {
return (
<div className="g-bg">
<div className="g-polygon g-polygon-1"></div>
<div className="g-polygon g-polygon-2"></div>
<div className="g-polygon g-polygon-3"></div>
</div>
);
};
export default GlassBg;
+42 -10
View File
@@ -1,5 +1,14 @@
import { RightOutlined } from '@ant-design/icons';
import { Button, Checkbox, Col, Empty, Row, Spin } from 'antd';
import {
Button,
Checkbox,
Col,
Empty,
Pagination,
Row,
Spin,
type PaginationProps
} from 'antd';
import _ from 'lodash';
import React, { useEffect, useRef, useState } from 'react';
import TableHeader from './components/table-header';
@@ -7,7 +16,9 @@ import TableRow from './components/table-row';
import './styles/index.less';
import { SealColumnProps, SealTableProps } from './types';
const SealTable: React.FC<SealTableProps> = (props) => {
const SealTable: React.FC<SealTableProps & { pagination: PaginationProps }> = (
props
) => {
const {
children,
rowKey,
@@ -19,6 +30,7 @@ const SealTable: React.FC<SealTableProps> = (props) => {
pollingChildren,
watchChildren,
rowSelection,
pagination,
renderChildren,
loadChildren,
loadChildrenAPI
@@ -55,6 +67,15 @@ const SealTable: React.FC<SealTableProps> = (props) => {
setIndeterminate(false);
}
};
const handlePageChange = (page: number, pageSize: number) => {
pagination?.onChange?.(page, pageSize);
};
const handlePageSizeChange = (current: number, size: number) => {
pagination?.onShowSizeChange?.(current, size);
};
const renderHeaderPrefix = () => {
if (expandable && rowSelection) {
return (
@@ -153,16 +174,27 @@ const SealTable: React.FC<SealTableProps> = (props) => {
);
};
return (
<div className="seal-table-container">
{renderHeader()}
{loading ? (
<div className="spin">
<Spin></Spin>
<>
<div className="seal-table-container">
{renderHeader()}
{loading ? (
<div className="spin">
<Spin></Spin>
</div>
) : (
renderContent()
)}
</div>
{pagination && (
<div className="pagination-wrapper">
<Pagination
{...pagination}
onChange={handlePageChange}
onShowSizeChange={handlePageSizeChange}
></Pagination>
</div>
) : (
renderContent()
)}
</div>
</>
);
};
@@ -1,3 +1,9 @@
.pagination-wrapper {
display: flex;
justify-content: flex-end;
margin: var(--ant-margin) 0;
}
.seal-table-container {
display: flex;
flex-direction: column;