diff --git a/superset-frontend/packages/superset-ui-core/src/components/Pagination/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/Pagination/index.tsx new file mode 100644 index 000000000000..62c2423a1d80 --- /dev/null +++ b/superset-frontend/packages/superset-ui-core/src/components/Pagination/index.tsx @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { Pagination as AntdPagination } from 'antd'; +import type { PaginationProps as AntdPaginationProps } from 'antd'; + +export type PaginationProps = AntdPaginationProps; + +export const Pagination = AntdPagination; diff --git a/superset-frontend/packages/superset-ui-core/src/components/index.ts b/superset-frontend/packages/superset-ui-core/src/components/index.ts index 12a0504ce55e..96d17aa65471 100644 --- a/superset-frontend/packages/superset-ui-core/src/components/index.ts +++ b/superset-frontend/packages/superset-ui-core/src/components/index.ts @@ -147,6 +147,8 @@ export { Loading, type LoadingProps } from './Loading'; export { Progress, type ProgressProps } from './Progress'; +export { Pagination, type PaginationProps } from './Pagination'; + export { Skeleton, type SkeletonProps } from './Skeleton'; export { Switch, type SwitchProps } from './Switch'; diff --git a/superset-frontend/src/components/ListView/ListView.tsx b/superset-frontend/src/components/ListView/ListView.tsx index 80d495168061..c1854462f871 100644 --- a/superset-frontend/src/components/ListView/ListView.tsx +++ b/superset-frontend/src/components/ListView/ListView.tsx @@ -28,6 +28,7 @@ import { Icons, EmptyState, Loading, + Pagination, type EmptyStateProps, } from '@superset-ui/core/components'; import CardCollection from './CardCollection'; @@ -91,6 +92,7 @@ const ListViewStyles = styled.div` .row-count-container { margin-top: ${theme.sizeUnit * 2}px; color: ${theme.colorText}; + text-align: center; } `} `; @@ -446,14 +448,39 @@ export function ListView({ /> )} {viewMode === 'card' && ( - + <> + + {count > 0 && ( +
+ { + gotoPage(page - 1); + }} + size="default" + showSizeChanger={false} + showQuickJumper={false} + hideOnSinglePage + align="center" + /> +
+ {`${pageIndex * pageSize + 1}-${Math.min( + (pageIndex + 1) * pageSize, + count, + )} of ${count}`} +
+
+ )} + )} {viewMode === 'table' && ( <>