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

@@ -1,34 +0,0 @@
import type { DataGridProps } from "@/components/reui/legacy-data-grid/data-grid"
const DATA_GRID_CELL_PAD = "py-3"
const DATA_GRID_CELL_PAD_FIRST = "pl-5 py-3"
const DATA_GRID_CELL_PAD_LAST = "pr-4 py-3"
const DEFAULT_DATA_GRID_LAYOUT: NonNullable<DataGridProps<object>["tableLayout"]> = {
rowBorder: true,
headerBackground: true,
headerBorder: true,
columnsResizable: false,
}
const DEFAULT_DATA_GRID_CLASS_NAMES: NonNullable<DataGridProps<object>["tableClassNames"]> = {
headerRow: "border-b border-border",
bodyRow: "group/row",
}
const DATA_GRID_CONTAINER_CLASS = "w-full rounded-none border-0"
const DATA_PAGE_CARD_CLASS = "flex w-full flex-col overflow-hidden py-0 gap-0"
const DATA_PAGE_TOOLBAR_CLASS = "flex items-center gap-3 px-5 py-3 border-b flex-wrap"
export {
DATA_GRID_CELL_PAD,
DATA_GRID_CELL_PAD_FIRST,
DATA_GRID_CELL_PAD_LAST,
DEFAULT_DATA_GRID_LAYOUT,
DEFAULT_DATA_GRID_CLASS_NAMES,
DATA_GRID_CONTAINER_CLASS,
DATA_PAGE_CARD_CLASS,
DATA_PAGE_TOOLBAR_CLASS,
}
@@ -1,69 +0,0 @@
"use client"
import type { ReactNode } from "react"
import type { Table } from "@tanstack/react-table-v8"
import {
DataGrid,
DataGridContainer,
DataGridPagination,
DataGridTable,
type DataGridProps,
} from "@/components/reui/legacy-data-grid"
import {
DATA_GRID_CONTAINER_CLASS,
DEFAULT_DATA_GRID_CLASS_NAMES,
DEFAULT_DATA_GRID_LAYOUT,
} from "@/components/data-grids/shared/legacy-data-grid-layout"
interface DataGridShellProps<TData extends object> {
table: Table<TData>
recordCount: number
children?: ReactNode
pagination?: boolean
isLoading?: boolean
loadingMode?: DataGridProps<TData>["loadingMode"]
emptyMessage?: ReactNode
onRowClick?: DataGridProps<TData>["onRowClick"]
tableLayout?: DataGridProps<TData>["tableLayout"]
tableClassNames?: DataGridProps<TData>["tableClassNames"]
}
function DataGridShell<TData extends object>({
table,
recordCount,
children,
pagination = false,
isLoading,
loadingMode,
emptyMessage,
onRowClick,
tableLayout = DEFAULT_DATA_GRID_LAYOUT,
tableClassNames = DEFAULT_DATA_GRID_CLASS_NAMES,
}: DataGridShellProps<TData>) {
return (
<DataGrid
className="w-full"
table={table}
recordCount={recordCount}
isLoading={isLoading}
loadingMode={loadingMode}
emptyMessage={emptyMessage}
onRowClick={onRowClick}
tableLayout={tableLayout}
tableClassNames={tableClassNames}
>
{children ?? (
<>
<DataGridContainer border={false} className={DATA_GRID_CONTAINER_CLASS}>
<DataGridTable />
</DataGridContainer>
{pagination && recordCount > 0 && (
<DataGridPagination className="px-5 pb-3" />
)}
</>
)}
</DataGrid>
)
}
export { DataGridShell, type DataGridShellProps }
@@ -1,51 +0,0 @@
"use client"
import type { Column } from "@tanstack/react-table-v8"
import { cn } from "@/lib/utils"
import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon } from "lucide-react"
interface DataGridSortHeaderProps<TData> {
column: Column<TData, unknown>
title: string
className?: string
}
function DataGridSortHeader<TData>({
column,
title,
className,
}: DataGridSortHeaderProps<TData>) {
const sorted = column.getIsSorted()
const canSort = column.getCanSort()
if (!canSort) {
return (
<span className={cn("text-xs font-medium text-muted-foreground", className)}>
{title}
</span>
)
}
return (
<button
type="button"
className={cn(
"inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground",
"hover:text-foreground transition-colors rounded-md -ml-1 px-1 py-0.5",
className,
)}
onClick={column.getToggleSortingHandler()}
>
{title}
{sorted === "asc" ? (
<ArrowUpIcon className="size-3 text-foreground" />
) : sorted === "desc" ? (
<ArrowDownIcon className="size-3 text-foreground" />
) : (
<ArrowUpDownIcon className="size-3 opacity-35" />
)}
</button>
)
}
export { DataGridSortHeader, type DataGridSortHeaderProps }