import { Button, Classes } from '@blueprintjs/core'; import { useFormContext, useWatch } from 'react-hook-form'; import { FaRegTrashAlt } from 'react-icons/fa'; import type { CellProps } from 'react-table'; import { NumberInput2Controller } from '../../elements/NumberInput2Controller.js'; import type { Column } from '../../elements/ReactTable/ReactTable.js'; import ReactTable from '../../elements/ReactTable/ReactTable.js'; export function ExclusionsZonesTable() { const { setValue, control } = useFormContext(); const exclusionsZones = useWatch({ name: 'exclusionsZones' }); if (!exclusionsZones || !Array.isArray(exclusionsZones)) { return null; } function handleDelete(index: any) { setValue( 'exclusionsZones', exclusionsZones.filter((_: any, i: any) => i !== index), ); } const exclusionsZonesColumns: Array> = [ { Header: '#', style: { width: '50px' }, accessor: (_: any, index) => index + 1, }, { Header: 'from', Cell: ({ row }: CellProps) => ( ), }, { Header: 'To', Cell: ({ row }: CellProps) => ( ), }, { Header: '', style: { width: '70px' }, id: 'actions', Cell: ({ row }: CellProps) => { return ( ); }, }, ]; return ( ); }