UNPKG

rjsf-antd

Version:

Ant Design theme, fields and widgets for react-jsonschema-form

18 lines 942 B
import React from 'react'; import { Radio } from 'antd'; var RadioWidget = function (_a) { var options = _a.options, value = _a.value, disabled = _a.disabled, readonly = _a.readonly, onChange = _a.onChange; // Generating a unique field name to identify this set of radio buttons var name = Math.random().toString(); var enumOptions = options.enumOptions, enumDisabled = options.enumDisabled; var _onChange = function (e) { onChange(e.target.value); }; return (React.createElement(Radio.Group, { name: name, value: value, onChange: _onChange }, enumOptions.map(function (option, i) { var itemDisabled = enumDisabled && enumDisabled.indexOf(option.value) !== -1; return (React.createElement(Radio, { value: option.value, key: i, disabled: disabled || itemDisabled || readonly }, "" + option.label)); }))); }; export default RadioWidget; //# sourceMappingURL=RadioWidget.js.map