@@ -3,6 +3,13 @@ import Affix from './Affix';
33import SelectContent from './Content' ;
44import SelectInputContext from './context' ;
55import type { DisplayValueType , Mode } from '../interface' ;
6+ import useBaseProps from '../hooks/useBaseProps' ;
7+ import { omit , useEvent } from '@rc-component/util' ;
8+ import KeyCode from '@rc-component/util/lib/KeyCode' ;
9+ import { isValidateOpenKey } from '../utils/keyUtil' ;
10+ import clsx from 'clsx' ;
11+ import type { FilledComponentsConfig } from '../hooks/useComponents' ;
12+ import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode' ;
613
714export interface SelectInputRef {
815 focus : ( options ?: FocusOptions ) => void ;
@@ -36,13 +43,8 @@ export interface SelectInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme
3643 className ?: string ;
3744 style ?: React . CSSProperties ;
3845 focused ?: boolean ;
39- [ key : string ] : any ;
46+ components : FilledComponentsConfig ;
4047}
41- import useBaseProps from '../hooks/useBaseProps' ;
42- import { omit , useEvent } from '@rc-component/util' ;
43- import KeyCode from '@rc-component/util/lib/KeyCode' ;
44- import { isValidateOpenKey } from '../utils/keyUtil' ;
45- import clsx from 'clsx' ;
4648
4749const DEFAULT_OMIT_PROPS = [
4850 'value' ,
@@ -172,7 +174,9 @@ export default React.forwardRef<SelectInputRef, SelectInputProps>(function Selec
172174 // ====================== Open ======================
173175 const onInternalMouseDown : SelectInputProps [ 'onMouseDown' ] = useEvent ( ( event ) => {
174176 if ( ! disabled ) {
175- event . preventDefault ( ) ;
177+ if ( event . target !== getDOM ( inputRef . current ) ) {
178+ event . preventDefault ( ) ;
179+ }
176180
177181 // Check if we should prevent closing when clicking on selector
178182 // Don't close if: open && not multiple && (combobox mode || showSearch)
@@ -181,13 +185,6 @@ export default React.forwardRef<SelectInputRef, SelectInputProps>(function Selec
181185 if ( ! ( event . nativeEvent as any ) . _select_lazy ) {
182186 inputRef . current ?. focus ( ) ;
183187
184- // Clear search value if autoClearSearchValue is not false when closing
185- if ( ( mode !== 'combobox' && ( ! showSearch || shouldPreventClose ) ) || ! triggerOpen ) {
186- if ( triggerOpen && autoClearSearchValue !== false ) {
187- onSearch ?.( '' , true , false ) ;
188- }
189- }
190-
191188 // Only toggle open if we should not prevent close
192189 if ( ! shouldPreventClose ) {
193190 toggleOpen ( ) ;
0 commit comments