fix(ui): перенести таблицу рекурсивных маршрутов на ReUI v9
This commit is contained in:
1 parent
ddf1851e92
commit
1ea07f65b2
3 files changed
+54
-13
No files matched your search
@@ -1,23 +1,22 @@
|
||||
"use client"
|
||||
|
||||
import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
|
||||
|
||||
import { useMemo, useState } from "react"
|
||||
import {
|
||||
type ColumnDef,
|
||||
getCoreRowModel,
|
||||
getExpandedRowModel,
|
||||
getSortedRowModel,
|
||||
useReactTable,
|
||||
} from "@tanstack/react-table-v8"
|
||||
useTable,
|
||||
} from "@tanstack/react-table"
|
||||
import { Flag } from "@/components/flag"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { DataGridShell } from "@/components/data-grids/shared/legacy-data-grid-shell"
|
||||
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 {
|
||||
AlertCircleIcon,
|
||||
@@ -131,7 +130,7 @@ function RecursiveRoutesDataGrid({
|
||||
return g ? { [(g.id ?? g.key)]: true } : {}
|
||||
}, [expandedKey, groups])
|
||||
|
||||
const columns = useMemo<ColumnDef<RecursiveRouteGroup>[]>(
|
||||
const columns = useMemo<ColumnDef<DataGridFeatures, RecursiveRouteGroup>[]>(
|
||||
() => [
|
||||
{
|
||||
id: "route",
|
||||
@@ -289,12 +288,11 @@ function RecursiveRoutesDataGrid({
|
||||
[confirmDeleteKey, expandedKey, onDelete, onEdit],
|
||||
)
|
||||
|
||||
const table = useReactTable({
|
||||
const table = useTable({
|
||||
features: dataGridFeatures,
|
||||
manualPagination: true,
|
||||
data: groups,
|
||||
columns,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
getSortedRowModel: getSortedRowModel(),
|
||||
getExpandedRowModel: getExpandedRowModel(),
|
||||
getRowId: (row) => row.id ?? row.key,
|
||||
getRowCanExpand: () => true,
|
||||
state: { expanded },
|
||||
|
||||
Reference in new issue
Block a user