import clsx from 'clsx'; import classes from './MRT_FilterCheckBox.module.css'; import { Checkbox, type CheckboxProps, Tooltip } from '@mantine/core'; import { type MRT_CellValue, type MRT_Column, type MRT_RowData, type MRT_TableInstance, } from '../../types'; import { parseFromValuesOrFunc } from '../../utils/utils'; interface Props extends CheckboxProps { column: MRT_Column; table: MRT_TableInstance; } export const MRT_FilterCheckbox = ({ column, table, ...rest }: Props) => { 'use no memo'; const { getState, options: { localization, mantineFilterCheckboxProps }, } = table; const { density } = getState(); const { columnDef } = column; const arg = { column, table }; const checkboxProps = { ...parseFromValuesOrFunc(mantineFilterCheckboxProps, arg), ...parseFromValuesOrFunc(columnDef.mantineFilterCheckboxProps, arg), ...rest, } as CheckboxProps; const filterLabel = localization.filterByColumn?.replace( '{column}', columnDef.header, ); const value = column.getFilterValue(); return ( { column.setFilterValue( column.getFilterValue() === undefined ? 'true' : column.getFilterValue() === 'true' ? 'false' : undefined, ); checkboxProps?.onChange?.(e); }} onClick={(e) => { e.stopPropagation(); checkboxProps?.onClick?.(e); }} title={undefined} /> ); };