UNPKG

react-admin-component

Version:
23 lines 1.33 kB
import * as tslib_1 from "tslib"; import React from 'react'; import { Form, Checkbox } from 'antd'; import classNames from 'classnames'; var FormCheckbox = function (props) { var form = props.form, className = props.className, field = props.field, initialValue = props.initialValue, readOnly = props.readOnly, render = props.render, options = props.options, label = props.label, labelCol = props.labelCol, wrapperCol = props.wrapperCol; var _a = form, getFieldDecorator = _a.getFieldDecorator, getFieldValue = _a.getFieldValue, setFieldsValue = _a.setFieldsValue; var onChange = function (value) { var _a; setFieldsValue((_a = {}, _a[field] = value, _a)); }; return (React.createElement(Form.Item, tslib_1.__assign({}, { label: label, labelCol: labelCol, wrapperCol: wrapperCol, }, { className: classNames('rac_form_input', className) }), getFieldDecorator(field, { initialValue: initialValue, })(readOnly ? (render ? (render(getFieldValue(field))) : (React.createElement("span", null, getFieldValue(field)))) : (React.createElement(Checkbox.Group, { style: { width: '100%' }, options: options, onChange: function (value) { onChange(value); } }))))); }; export default FormCheckbox; //# sourceMappingURL=index.js.map