芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/app.optimyar.com/backend/.cache/admin/src/components/Webhooks/EventInput/EventRow.js
import React from 'react'; import PropTypes from 'prop-types'; import { Checkbox } from '@buffetjs/core'; const EventRow = ({ disabledEvents, name, events, inputValue, handleChange, handleChangeAll }) => { const enabledCheckboxes = events.filter(event => { return !disabledEvents.includes(event); }); const areAllCheckboxesSelected = inputValue.length === enabledCheckboxes.length; const hasSomeCheckboxSelected = inputValue.length > 0; const onChangeAll = ({ target: { name } }) => { const valueToSet = !areAllCheckboxesSelected; handleChangeAll({ target: { name, value: valueToSet }, }); }; return (
{events.map(event => { return (
); })}
); }; EventRow.defaultProps = { disabledEvents: [], events: [], inputValue: [], handleChange: () => {}, handleChangeAll: () => {}, }; EventRow.propTypes = { disabledEvents: PropTypes.array, events: PropTypes.array, inputValue: PropTypes.array, handleChange: PropTypes.func, handleChangeAll: PropTypes.func, name: PropTypes.string.isRequired, }; export default EventRow;