import type { ColumnDef } from "@tanstack/react-table" import { Checkbox } from "@/components/ui/checkbox" import { cn, stopInteractivePropagation } from "@/lib/utils" export type DataTableSelectColumnProps = { id?: string size?: number headerClassName?: string cellClassName?: string ariaLabel?: { selectAll?: string selectRow?: (row: TData) => string } } export type DataTableSelectColumn = ( props?: DataTableSelectColumnProps ) => ColumnDef function createDataTableSelectColumn({ id = "select", size = 40, headerClassName, cellClassName, ariaLabel, }: DataTableSelectColumnProps = {}): ColumnDef { return { id, size, enableSorting: false, enableHiding: false, header: ({ table }) => (
table.toggleAllPageRowsSelected(checked)} />
), cell: ({ row }) => (
row.toggleSelected(checked)} />
), } } export { createDataTableSelectColumn }