fix(ui): открыть крайние колонки сводной статистики

This commit is contained in:
Denozordec committed 2026-10-04 04:11:53 +07:00
1 parent 8d6d82082c
commit 488f2fe482
9 files changed
+100 -6

No files matched your search

+12 -2
View File
@@ -1,6 +1,6 @@
"use client"
import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
import { DataGridContainer, DataGridScrollArea, DataGridTable, dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
import { useMemo, useEffect, type ReactNode } from "react"
import {
@@ -31,6 +31,7 @@ interface CompactDataGridProps<T extends { id: string }> {
data: T[]
columns: CompactDataGridColumn<T>[]
isLoading?: boolean
horizontalScroll?: boolean
emptyTitle?: string
emptyDescription?: string
onRowClick?: (row: T) => void
@@ -41,6 +42,7 @@ function CompactDataGrid<T extends { id: string }>({
data,
columns,
isLoading,
horizontalScroll = false,
emptyTitle = "Нет записей",
emptyDescription,
onRowClick,
@@ -118,7 +120,15 @@ function CompactDataGrid<T extends { id: string }>({
className="border-0 py-10"
/>
}
/>
>
{horizontalScroll ? (
<DataGridContainer border={false} className="w-full rounded-none border-0">
<DataGridScrollArea orientation="horizontal">
<DataGridTable />
</DataGridScrollArea>
</DataGridContainer>
) : undefined}
</DataGridShell>
)
}
@@ -47,20 +47,24 @@ export function StatisticsPivotGrid({
accessorKey: `c:${col.id}` as const,
cell: (row: PivotGridRow) => {
const value = Number(row[`c:${col.id}`] ?? 0)
const label = data.metric === "packets" ? value.toLocaleString("ru-RU") : formatBytes(value)
if (col.id === "__other__" || row.id === "__other__") {
return <span className="tabular-nums text-muted-foreground">{label}</span>
}
return (
<button
type="button"
aria-label={`${row.label}, ${col.label}: ${label}. Показать срез`}
className={cn(
"tabular-nums text-left hover:underline",
col.id === "__other__" || row.id === "__other__" ? "text-muted-foreground" : "",
)}
onClick={(e) => {
e.stopPropagation()
if (row.id === "__other__" || col.id === "__other__") return
onCellClick?.(row.id, col.id)
}}
>
{data.metric === "packets" ? value.toLocaleString("ru-RU") : formatBytes(value)}
{label}
</button>
)
},
@@ -80,6 +84,7 @@ export function StatisticsPivotGrid({
return (
<CompactDataGrid
data={rows}
horizontalScroll
columns={columns}
isLoading={isLoading}
emptyTitle="Нет данных сводной"