chore(ui): удалить старую основу Data Grid и TanStack v8

This commit is contained in:
Denozordec committed 2026-09-14 22:05:50 +07:00
1 parent bdba83b2b6
commit a475b5c6df
20 files changed
+22 -4272

No files matched your search

+12 -14
View File
@@ -1,20 +1,19 @@
"use client"
import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
import { useMemo, useState } from "react"
import {
type ColumnDef,
getCoreRowModel,
getPaginationRowModel,
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 { DataPageCard } from "@/components/data-page-card"
import { DataPageToolbar } from "@/components/data-page-toolbar"
import { EmptyState } from "@/components/empty-state"
@@ -60,9 +59,9 @@ export function DataTable<T extends { id: string }>({
)
}, [data, search, searchKeys])
const columnDefs = useMemo<ColumnDef<T>[]>(
const columnDefs = useMemo<ColumnDef<DataGridFeatures, T>[]>(
() => {
const defs: ColumnDef<T>[] = columns.map((col, index) => ({
const defs: ColumnDef<DataGridFeatures, T>[] = columns.map((col, index) => ({
id: col.key,
accessorKey: col.key,
header: ({ column }) => (
@@ -91,12 +90,11 @@ export function DataTable<T extends { id: string }>({
[columns],
)
const table = useReactTable({
const table = useTable({
features: dataGridFeatures,
manualPagination: !pagination,
data: filteredData,
columns: columnDefs,
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
...(pagination ? { getPaginationRowModel: getPaginationRowModel() } : {}),
getRowId: (row) => row.id,
})