import { Button } from "antd"; import { ChevronLeft, ChevronRight, ListFilter, RotateCcw } from "lucide-react"; import type { ReactNode } from "react"; import { useEffect, useState } from "react"; import { cn } from "@/lib/utils"; import { Select } from "@/components/ui/base/select"; export function WorkspacePage({ children, className, grid = false, fluid = false, scroll = true }: { children: ReactNode; className?: string; grid?: boolean; fluid?: boolean; scroll?: boolean }) { return (
{children}
); } export function PageHeader({ title, description, meta, actions }: { title: string; description?: string; meta?: ReactNode; actions?: ReactNode }) { return (

{title}

{meta}
{description ?

{description}

: null}
{actions ?
{actions}
: null}
); } export function ListToolbar({ children, filters, filtersAlwaysVisible = false, activeFilters, trailing, active, onReset, className, }: { children: ReactNode; filters?: ReactNode; filtersAlwaysVisible?: boolean; activeFilters?: ReactNode; trailing?: ReactNode; active?: boolean; onReset?: () => void; className?: string; }) { const [filtersOpen, setFiltersOpen] = useState(false); useEffect(() => { if (active) setFiltersOpen(true); }, [active]); return (
{children} {filters ? ( <> {!filtersAlwaysVisible ? ( ) : null}
{filters}
) : null} {activeFilters ?
{activeFilters}
: null}
{active && onReset ? ( ) : null} {trailing}
); } export function TableSurface({ children, className }: { children: ReactNode; className?: string }) { return
{children}
; } export function CollectionGrid({ children, className, style }: { children: ReactNode; className?: string; style?: React.CSSProperties }) { return
{children}
; } /* 自研轻量分页:页码胶囊 + 省略号 + 每页条数 + 总数,替代 AntD Pagination(无 AntD 残留样式,与工具栏容器同语言)。 */ function pageItems(current: number, pages: number): (number | "…")[] { if (pages <= 7) return Array.from({ length: pages }, (_, i) => i + 1); if (current <= 4) return [1, 2, 3, 4, 5, "…", pages]; if (current >= pages - 3) return [1, "…", pages - 4, pages - 3, pages - 2, pages - 1, pages]; return [1, "…", current - 1, current, current + 1, "…", pages]; } export function PaginationBar({ current, pageSize, total, onChange, pageSizeOptions = [20, 50, 100], alwaysShow = false, itemLabel = "条", }: { current: number; pageSize: number; total: number; onChange: (page: number, pageSize: number) => void; pageSizeOptions?: number[]; alwaysShow?: boolean; itemLabel?: string; }) { if (!alwaysShow && total <= pageSize && current === 1) return null; const pages = Math.max(1, Math.ceil(total / pageSize)); const start = total === 0 ? 0 : (current - 1) * pageSize + 1; const end = total === 0 ? 0 : Math.min(total, current * pageSize); const items = pageItems(current, pages); return (
{total === 0 ? `共 0 ${itemLabel}` : `${start}-${end} / 共 ${total} ${itemLabel}`}