/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /** * Per-column actions menu for the Lists results table header. Brings * grouping / aggregation / sorting onto the table itself so the user never * has to round-trip through the list settings. */ import { ArrowUp, ArrowDown, Group, Ungroup, Sigma, Palette, MoreVertical } from 'lucide-react'; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuSeparator, } from '@/components/ui/dropdown-menu'; import { cn } from '@/lib/utils'; interface ColumnHeaderMenuProps { isNumeric: boolean; isGroupedBy: boolean; isSummed: boolean; active: boolean; onSort: (dir: 'asc' | 'desc') => void; onToggleGroup: () => void; onToggleSum: () => void; onColorBy: () => void; } export function ColumnHeaderMenu({ isNumeric, isGroupedBy, isSummed, active, onSort, onToggleGroup, onToggleSum, onColorBy, }: ColumnHeaderMenuProps) { return ( onSort('asc')}> Sort ascending onSort('desc')}> Sort descending {isGroupedBy ? (<> Remove grouping) : (<> Group by this column)} {isNumeric ? 'Sum / total this column' : 'Sum (numeric only)'} Colour by this column ); }