components.form.fields.multiple.MultipleTableHeader.tsx Maven / Gradle / Ivy
import _ from 'lodash'
import { TableHead, TableRow, TableCell, Checkbox } from '@mui/material'
import { MultipleTableHeaderFieldCells } from 'components/form/fields/multiple'
import { MultipleRowProps } from 'components/form/fields/multiple/MultipleTable'
const MultipleTableHeader = (props: MultipleRowProps) => {
const { select, reorder, add, remove } = props.features
return (
{reorder ? (
) : null}
{select ? (
) : null}
{add || remove ? (
) : null}
)
}
const MultipleCheckBox = ({rows, selected, setSelected}: any) => {
const handleChange = (event: any, value: any) => {
if (value)
setSelected(_.range(rows.length))
else
setSelected([])
}
const indeterminate = Boolean(selected.length && selected.length < rows.length)
const checked = Boolean(rows.length > 0 && selected.length === rows.length)
return (
)
}
export default MultipleTableHeader