mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
more
This commit is contained in:
parent
41f82fe7f8
commit
1bb2b39423
|
@ -4,13 +4,22 @@ import Select from '../Select';
|
||||||
import Slider from '../Slider';
|
import Slider from '../Slider';
|
||||||
|
|
||||||
/* eslint-disable react/prop-types */
|
/* eslint-disable react/prop-types */
|
||||||
const SelectWidget: Widget = ({ options, onChange, value, ...rest }) => (
|
const SelectWidget: Widget = ({
|
||||||
<Select
|
options,
|
||||||
options={options.enumOptions}
|
onChange,
|
||||||
onChange={(option: { value: string }) => {
|
value,
|
||||||
onChange(option.value);
|
onBlur,
|
||||||
|
defaultValue,
|
||||||
|
tabIndex,
|
||||||
|
onFocus,
|
||||||
|
...rest
|
||||||
|
}) => (
|
||||||
|
<Select<{ label: string; value: string }>
|
||||||
|
options={options.enumOptions as { label: string; value: string }[]}
|
||||||
|
onChange={(option) => {
|
||||||
|
onChange(option?.value);
|
||||||
}}
|
}}
|
||||||
value={(options.enumOptions as { value: string }[]).find(
|
value={(options.enumOptions as { label: string; value: string }[]).find(
|
||||||
(option) => option.value === value
|
(option) => option.value === value
|
||||||
)}
|
)}
|
||||||
{...rest}
|
{...rest}
|
||||||
|
|
|
@ -81,11 +81,18 @@ export class Select<
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ExternalSelectProps<
|
||||||
|
Option extends OptionTypeBase = OptionTypeBase,
|
||||||
|
IsMulti extends boolean = false
|
||||||
|
> extends Omit<ReactSelectProps<Option, IsMulti>, 'theme'> {
|
||||||
|
theme?: Theme;
|
||||||
|
}
|
||||||
|
|
||||||
type SelectComponent = <
|
type SelectComponent = <
|
||||||
Option extends OptionTypeBase = OptionTypeBase,
|
Option extends OptionTypeBase = OptionTypeBase,
|
||||||
IsMulti extends boolean = false
|
IsMulti extends boolean = false
|
||||||
>(
|
>(
|
||||||
props: SelectProps<Option, IsMulti>
|
props: ExternalSelectProps<Option, IsMulti>
|
||||||
) => ReactElement;
|
) => ReactElement;
|
||||||
|
|
||||||
export default createThemedComponent(Select) as SelectComponent & {
|
export default createThemedComponent(Select) as SelectComponent & {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user