- 列表补齐结算人、产品明细、押金、买断、备注,按业务顺序排列 - 长文本列(产品明细/备注)换行完整显示 - Table 组件新增可选 striped/bordered,仅客户列表启用 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import * as React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
/** 统一表格外观:外层 Card 内使用 */
|
|
export function Table({
|
|
className,
|
|
striped,
|
|
bordered,
|
|
...props
|
|
}: React.TableHTMLAttributes<HTMLTableElement> & {
|
|
striped?: boolean;
|
|
bordered?: boolean;
|
|
}) {
|
|
return (
|
|
<div className="w-full overflow-x-auto">
|
|
<table
|
|
className={cn(
|
|
"w-full text-sm",
|
|
bordered &&
|
|
"border border-[var(--color-border)] [&_tr]:divide-x [&_tr]:divide-[var(--color-border)]",
|
|
striped && "[&_tbody_tr:nth-child(even)]:bg-[var(--color-muted)]/50",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function THead(props: React.HTMLAttributes<HTMLTableSectionElement>) {
|
|
return (
|
|
<thead
|
|
className="bg-[var(--color-muted)] text-left text-xs uppercase tracking-wide text-[var(--color-muted-foreground)]"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export function TR({ className, ...props }: React.HTMLAttributes<HTMLTableRowElement>) {
|
|
return (
|
|
<tr
|
|
className={cn("border-b last:border-0 hover:bg-[var(--color-muted)]/60", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export function TH({ className, ...props }: React.ThHTMLAttributes<HTMLTableCellElement>) {
|
|
return <th className={cn("px-4 py-3 font-medium", className)} {...props} />;
|
|
}
|
|
|
|
export function TD({ className, ...props }: React.TdHTMLAttributes<HTMLTableCellElement>) {
|
|
return <td className={cn("px-4 py-3 align-middle", className)} {...props} />;
|
|
}
|