Docker images / prepare-release (push) Successful in 5s
Docker images / backend-image (push) Successful in 2m37s
Docker images / frontend-image (push) Successful in 2m22s
Docker images / updater-image (push) Successful in 38s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 8s
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
"use client"
|
|
|
|
import { ReactElement } from "react"
|
|
import { getColumnHeaderLabel } from "@/components/reui/data-grid/data-grid"
|
|
import { Table } from "@tanstack/react-table"
|
|
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuCheckboxItem,
|
|
DropdownMenuContent,
|
|
DropdownMenuGroup,
|
|
DropdownMenuLabel,
|
|
DropdownMenuTrigger,
|
|
} from "@/components/ui/dropdown-menu"
|
|
|
|
function DataGridColumnVisibility<TData>({
|
|
table,
|
|
trigger,
|
|
}: {
|
|
table: Table<TData>
|
|
trigger: ReactElement<Record<string, unknown>>
|
|
}) {
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger render={trigger} />
|
|
<DropdownMenuContent align="end" className="min-w-[150px]">
|
|
<DropdownMenuGroup>
|
|
<DropdownMenuLabel className="font-medium">
|
|
Toggle Columns
|
|
</DropdownMenuLabel>
|
|
{table
|
|
.getAllColumns()
|
|
.filter((column) => column.getCanHide())
|
|
.map((column) => {
|
|
return (
|
|
<DropdownMenuCheckboxItem
|
|
key={column.id}
|
|
className="capitalize"
|
|
checked={column.getIsVisible()}
|
|
onSelect={(event) => event.preventDefault()}
|
|
onCheckedChange={(value) => column.toggleVisibility(!!value)}
|
|
>
|
|
{getColumnHeaderLabel(column)}
|
|
</DropdownMenuCheckboxItem>
|
|
)
|
|
})}
|
|
</DropdownMenuGroup>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|
|
|
|
export { DataGridColumnVisibility } |