fix(ui): перенести основные таблицы на ReUI v9

This commit is contained in:
Denozordec committed 2026-09-13 21:01:23 +07:00
1 parent 3d3c45e4d2
commit e66762ca2e
14 files changed
+287 -110

No files matched your search

+11 -13
View File
@@ -1,20 +1,19 @@
"use client"
import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
import { useMemo, type ReactNode } from "react"
import {
type ColumnDef,
getCoreRowModel,
getExpandedRowModel,
getSortedRowModel,
useReactTable,
} from "@tanstack/react-table-v8"
import { DataGridShell } from "@/components/data-grids/shared/legacy-data-grid-shell"
useTable,
} from "@tanstack/react-table"
import { DataGridShell } from "@/components/data-grids/shared/data-grid-shell"
import {
DATA_GRID_CELL_PAD,
DATA_GRID_CELL_PAD_FIRST,
DATA_GRID_CELL_PAD_LAST,
} from "@/components/data-grids/shared/legacy-data-grid-layout"
import { DataGridSortHeader } from "@/components/data-grids/shared/legacy-data-grid-sort-header"
} from "@/components/data-grids/shared/data-grid-layout"
import { DataGridSortHeader } from "@/components/data-grids/shared/data-grid-sort-header"
import { EmptyState } from "@/components/empty-state"
import { InboxIcon } from "lucide-react"
@@ -47,7 +46,7 @@ function CompactDataGrid<T extends { id: string }>({
onRowClick,
getExpandedContent,
}: CompactDataGridProps<T>) {
const columnDefs = useMemo<ColumnDef<T>[]>(
const columnDefs = useMemo<ColumnDef<DataGridFeatures, T>[]>(
() =>
columns.map((col, index) => ({
id: col.id,
@@ -81,12 +80,11 @@ function CompactDataGrid<T extends { id: string }>({
[columns, getExpandedContent],
)
const table = useReactTable({
const table = useTable({
features: dataGridFeatures,
manualPagination: true,
data,
columns: columnDefs,
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
...(getExpandedContent ? { getExpandedRowModel: getExpandedRowModel() } : {}),
getRowId: (row) => row.id,
...(getExpandedContent ? { getRowCanExpand: () => true } : {}),
})