fix(mui): review fixes — Select string contract, DataTable aria-sort, sx/page-clamp/dev-warn
Select value/option restricted to string (MUI sets the literal child value; string|number + onChange:string was a type lie). DataTable sortDirection uses ?? 'asc' so aria-sort is never undefined on the active column. StatusChip sx-merge drops undefined; Pagination clamps page into range; DataTable dev-warns on sortKey without onSort; Alert onClose JSDoc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,9 @@ export default function DataTable<T>({
|
||||
sortDir,
|
||||
onSort,
|
||||
}: DataTableProps<T>) {
|
||||
if (import.meta.env.DEV && columns.some((c) => c.sortKey) && !onSort) {
|
||||
console.warn("DataTable: columns with sortKey require an onSort prop.");
|
||||
}
|
||||
if (rows.length === 0 && empty) return <>{empty}</>;
|
||||
return (
|
||||
<TableContainer sx={{ borderRadius: 2 }}>
|
||||
@@ -54,7 +57,7 @@ export default function DataTable<T>({
|
||||
key={c.key}
|
||||
align={c.align}
|
||||
sortDirection={
|
||||
c.sortKey && sortBy === c.sortKey ? sortDir : false
|
||||
c.sortKey && sortBy === c.sortKey ? (sortDir ?? "asc") : false
|
||||
}
|
||||
sx={{
|
||||
textTransform: "uppercase",
|
||||
|
||||
Reference in New Issue
Block a user