1515 */
1616
1717import { WidgetProps } from '@rjsf/utils'
18- import ReactSelect , { MenuListProps , components } from 'react-select'
19- import { PLACEHOLDERS } from '../constants'
18+ import { PLACEHOLDERS , RJSF_FORM_SELECT_PORTAL_TARGET_ID } from '../constants'
2019
21- import { ReactComponent as ArrowDown } from '../../../Assets/Icon/ic-chevron-down.svg'
2220import { deepEqual } from '@Common/Helper'
23- import { commonSelectStyles } from '@Shared/Components'
24-
25- const MenuList = ( { children, ...props } : MenuListProps ) => (
26- < components . MenuList { ...props } > { Array . isArray ( children ) ? children . slice ( 0 , 20 ) : children } </ components . MenuList >
27- )
28-
29- const DropdownIndicator = ( props ) => (
30- < components . DropdownIndicator { ...props } >
31- < ArrowDown className = "icon-dim-20 icon-n5" data-testid = "overview-project-edit-dropdown" />
32- </ components . DropdownIndicator >
33- )
21+ import { SelectPicker } from '@Shared/Components'
3422
3523export const SelectWidget = ( props : WidgetProps ) => {
3624 const {
@@ -47,7 +35,7 @@ export const SelectWidget = (props: WidgetProps) => {
4735 placeholder,
4836 } = props
4937 const { enumOptions : selectOptions = [ ] } = options
50- const emptyValue = multiple ? [ ] : ''
38+ const emptyValue = multiple ? [ ] : null
5139
5240 const handleChange = ( option ) => {
5341 onChange ( multiple ? option . map ( ( o ) => o . value ) : option . value )
@@ -59,8 +47,8 @@ export const SelectWidget = (props: WidgetProps) => {
5947 : selectOptions . find ( ( option ) => deepEqual ( value , option . value ) )
6048
6149 return (
62- < ReactSelect
63- id = { id }
50+ < SelectPicker
51+ inputId = { `devtron-rjsf-select__ ${ id } ` }
6452 name = { id }
6553 isMulti = { multiple }
6654 value = { typeof value === 'undefined' ? emptyValue : getOption ( value ) }
@@ -71,23 +59,8 @@ export const SelectWidget = (props: WidgetProps) => {
7159 onFocus = { ( ) => onFocus ( id , value ) }
7260 placeholder = { placeholder || PLACEHOLDERS . SELECT }
7361 isDisabled = { disabled || readonly }
74- styles = { {
75- ...commonSelectStyles ,
76- control : ( base , state ) => ( {
77- ...commonSelectStyles . control ( base , state ) ,
78- minHeight : '36px' ,
79- } ) ,
80- multiValue : ( base , state ) => ( {
81- ...commonSelectStyles . multiValue ( base , state ) ,
82- margin : '2px 8px 2px 2px' ,
83- } ) ,
84- } }
85- components = { {
86- IndicatorSeparator : null ,
87- DropdownIndicator,
88- MenuList,
89- } }
90- menuPlacement = "auto"
62+ menuPortalTarget = { document . getElementById ( RJSF_FORM_SELECT_PORTAL_TARGET_ID ) }
63+ menuPosition = 'fixed'
9164 />
9265 )
9366}
0 commit comments