chore(ui): завершить миграцию Filters и удалить старый API
This commit is contained in:
1 parent
4fd844f977
commit
0d418e2e39
6 files changed
+37
-2025
No files matched your search
@@ -1,19 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { ReactNode } from "react"
|
||||
import { ListFilterIcon, SearchIcon } from "lucide-react"
|
||||
import { SearchIcon } from "lucide-react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupInput,
|
||||
} from "@/components/ui/input-group"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
Filters,
|
||||
type Filter,
|
||||
type FilterFieldConfig,
|
||||
} from "@/components/reui/filters"
|
||||
import { SegmentedControl } from "@/components/form-kit"
|
||||
import { DATA_PAGE_TOOLBAR_CLASS } from "@/components/data-grids/shared/data-grid-layout"
|
||||
|
||||
@@ -41,9 +35,6 @@ interface DataPageToolbarProps<T extends string = string> {
|
||||
onChange: (value: T) => void
|
||||
options: { value: T; label: string; count?: number }[]
|
||||
}
|
||||
filters?: Filter[]
|
||||
onFiltersChange?: (filters: Filter[]) => void
|
||||
filterFields?: FilterFieldConfig[]
|
||||
filterControl?: ReactNode
|
||||
countLabel?: string
|
||||
actions?: ReactNode
|
||||
@@ -56,9 +47,6 @@ function DataPageToolbar<T extends string = string>({
|
||||
onSearchChange,
|
||||
searchPlaceholder = "Поиск…",
|
||||
segmented,
|
||||
filters,
|
||||
onFiltersChange,
|
||||
filterFields,
|
||||
filterControl,
|
||||
countLabel,
|
||||
actions,
|
||||
@@ -74,20 +62,7 @@ function DataPageToolbar<T extends string = string>({
|
||||
options={segmented.options}
|
||||
/>
|
||||
)}
|
||||
{filterControl ?? (filterFields && filters && onFiltersChange && (
|
||||
<Filters
|
||||
filters={filters}
|
||||
fields={filterFields}
|
||||
onChange={onFiltersChange}
|
||||
size="sm"
|
||||
trigger={
|
||||
<Button type="button" variant="outline" size="sm">
|
||||
<ListFilterIcon className="size-3.5" />
|
||||
Фильтры
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
{filterControl}
|
||||
{onSearchChange != null && (
|
||||
<InputGroup className="min-w-[220px] max-w-sm">
|
||||
<InputGroupAddon>
|
||||
|
||||
Reference in new issue
Block a user