feat: crypto dropdown should stay open when editing commissions
This commit is contained in:
parent
bee2dc42e6
commit
7af8079a2a
3 changed files with 8 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ const Autocomplete = ({
|
||||||
multiple,
|
multiple,
|
||||||
onChange,
|
onChange,
|
||||||
labelProp,
|
labelProp,
|
||||||
|
shouldStayOpen,
|
||||||
value: outsideValue,
|
value: outsideValue,
|
||||||
error,
|
error,
|
||||||
fullWidth,
|
fullWidth,
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ const AutocompleteFormik = ({ options, onChange, ...props }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeHandler = value => setFieldValue(name, value)
|
const onChangeHandler = value => setFieldValue(name, value)
|
||||||
|
const shouldStayOpen = !!props.shouldStayOpen
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
|
|
@ -38,7 +39,10 @@ const AutocompleteFormik = ({ options, onChange, ...props }) => {
|
||||||
if (!props.multiple) return setOpen(true)
|
if (!props.multiple) return setOpen(true)
|
||||||
setOpen(value?.length !== props.limit)
|
setOpen(value?.length !== props.limit)
|
||||||
}}
|
}}
|
||||||
onClose={() => setOpen(false)}
|
onClose={(event, reason) => {
|
||||||
|
if (shouldStayOpen && reason !== 'blur') setOpen(true)
|
||||||
|
else setOpen(false)
|
||||||
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,8 @@ const getOverridesFields = (getData, currency, auxElements) => {
|
||||||
valueProp: 'code',
|
valueProp: 'code',
|
||||||
labelProp: 'display',
|
labelProp: 'display',
|
||||||
multiple: true,
|
multiple: true,
|
||||||
onChange: onCryptoChange
|
onChange: onCryptoChange,
|
||||||
|
shouldStayOpen: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue