fix(devui): fix Select widget in Form (#722)

This commit is contained in:
Nathan Bierema 2021-06-06 17:40:55 -04:00 committed by GitHub
parent bb72311e1c
commit a8d99ee424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,8 +4,17 @@ import Select from '../Select';
import Slider from '../Slider';
/* eslint-disable react/prop-types */
const SelectWidget: Widget = ({ options, ...rest }) => (
<Select options={options.enumOptions} {...rest} />
const SelectWidget: Widget = ({ options, onChange, value, ...rest }) => (
<Select
options={options.enumOptions}
onChange={(option: { value: string }) => {
onChange(option.value);
}}
value={(options.enumOptions as { value: string }[]).find(
(option) => option.value === value
)}
{...rest}
/>
);
const RangeWidget: Widget = (({