You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import CheckInput from 'Components/Form/CheckInput';
|
|
import VirtualTableHeaderCell from './TableHeaderCell';
|
|
import styles from './TableSelectAllHeaderCell.css';
|
|
|
|
function getValue(allSelected, allUnselected) {
|
|
if (allSelected) {
|
|
return true;
|
|
} else if (allUnselected) {
|
|
return false;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
function TableSelectAllHeaderCell(props) {
|
|
const {
|
|
allSelected,
|
|
allUnselected,
|
|
onSelectAllChange
|
|
} = props;
|
|
|
|
const value = getValue(allSelected, allUnselected);
|
|
|
|
return (
|
|
<VirtualTableHeaderCell
|
|
className={styles.selectAllHeaderCell}
|
|
name="selectAll"
|
|
>
|
|
<CheckInput
|
|
className={styles.input}
|
|
name="selectAll"
|
|
value={value}
|
|
onChange={onSelectAllChange}
|
|
/>
|
|
</VirtualTableHeaderCell>
|
|
);
|
|
}
|
|
|
|
TableSelectAllHeaderCell.propTypes = {
|
|
allSelected: PropTypes.bool.isRequired,
|
|
allUnselected: PropTypes.bool.isRequired,
|
|
onSelectAllChange: PropTypes.func.isRequired
|
|
};
|
|
|
|
export default TableSelectAllHeaderCell;
|