Просмотр исходного кода

🐛 fix(shared-ui-components): 修复DataTablePagination组件缺少分页信息显示

- 添加分页信息显示:共 {totalCount} 条记录,第 {currentPage} / {totalPages} 页
- 更新测试验证分页信息正确显示
- 保持所有现有功能正常工作
- 所有测试通过,修复验证成功

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 1 месяц назад
Родитель
Сommit
df244cfc88

+ 6 - 0
packages/shared-ui-components/src/components/admin/DataTablePagination.tsx

@@ -64,6 +64,12 @@ export const DataTablePagination: React.FC<DataTablePaginationProps> = ({
 
   return (
     <div className="flex justify-between items-center mt-4">
+      {/* 分页信息 */}
+      <div className="text-sm text-muted-foreground">
+        共 {totalCount} 条记录,第 {currentPage} / {totalPages} 页
+      </div>
+
+      {/* 分页导航 */}
       <Pagination>
         <PaginationContent>
           <PaginationItem>

+ 3 - 0
packages/shared-ui-components/tests/unit/DataTablePagination.test.tsx

@@ -18,6 +18,9 @@ describe('DataTablePagination', () => {
     // 检查分页组件是否渲染
     expect(screen.getByRole('navigation')).toBeInTheDocument();
 
+    // 检查分页信息是否正确显示
+    expect(screen.getByText('共 100 条记录,第 1 / 10 页')).toBeInTheDocument();
+
     // 检查页码是否正确显示
     expect(screen.getByText('1')).toBeInTheDocument();
     expect(screen.getByText('10')).toBeInTheDocument();