xyh 2 лет назад
Родитель
Сommit
82c231f76f

+ 1 - 1
packages/app/src/components/table/header-th/index.tsx

@@ -35,7 +35,7 @@ const HeaderTh: FC<Props> = function ({header, update, getState}) {
     },
   });
 
-  const [_, dragRef] = useDrag({
+  const [, dragRef] = useDrag({
     type: 'table',
     item: () => header.column,
     collect(monitor) {

+ 9 - 0
packages/app/src/components/table/index.module.css

@@ -90,3 +90,12 @@
 .sticky {
   width: 100%;
 }
+
+.pagination {
+  width: 100%;
+  margin-top: 16px;
+
+  &:global(.ant-pagination) {
+    display: flex;
+  }
+}

+ 13 - 2
packages/app/src/components/table/index.tsx

@@ -1,4 +1,4 @@
-import {Spin} from 'antd';
+import {Spin, Pagination} from 'antd';
 import {ColumnsType} from 'antd/es/table';
 import {
   createPageContext,
@@ -19,6 +19,7 @@ type Props<T> = {
   pageContext: ReturnType<typeof createPageContext>;
   searchContext: ReturnType<typeof createSearchContext>;
   count: number;
+  /** @deprecated */
   rowKey?: string;
   'data-testid'?: string;
   pageSizeList?: string[];
@@ -31,7 +32,6 @@ function Table<T extends Record<string, any>>(props: Props<T>): ReactElement {
     pageContext,
     searchContext,
     count,
-    rowKey,
     pageSizeList = PAGE_SIZE_LIST,
   } = props;
   const [{page, pageSize}, {onPageChange}] = usePage(pageContext);
@@ -96,6 +96,17 @@ function Table<T extends Record<string, any>>(props: Props<T>): ReactElement {
           </tbody>
         </table>
       </div>
+      <Pagination
+        className={css.pagination}
+        pageSize={pageSize}
+        showQuickJumper
+        pageSizeOptions={pageSizeList}
+        total={count}
+        showSizeChanger
+        onChange={onPageChange}
+        current={page}
+        showTotal={total => `共${total}条数据`}
+      />
     </Spin>
   );
 }