@@ -3,7 +3,9 @@ import Trigger from 'rc-trigger';
3
3
import classNames from 'classnames' ;
4
4
import type { Placement , RenderDOMFunc } from './BaseSelect' ;
5
5
6
- const getBuiltInPlacements = ( adjustX : number ) => {
6
+ const getBuiltInPlacements = ( dropdownMatchSelectWidth : number | boolean ) => {
7
+ // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
8
+ const adjustX = dropdownMatchSelectWidth === true ? 0 : 1 ;
7
9
return {
8
10
bottomLeft : {
9
11
points : [ 'tl' , 'bl' ] ,
@@ -40,13 +42,6 @@ const getBuiltInPlacements = (adjustX: number) => {
40
42
} ;
41
43
} ;
42
44
43
- const getAdjustX = ( adjustXDependencies : Pick < SelectTriggerProps , 'autoAdjustOverflow' | 'dropdownMatchSelectWidth' > ) => {
44
- const { autoAdjustOverflow, dropdownMatchSelectWidth } = adjustXDependencies ;
45
- if ( ! ! autoAdjustOverflow ) return 1 ;
46
- // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
47
- return typeof dropdownMatchSelectWidth !== 'number' ? 0 : 1
48
- }
49
-
50
45
export interface RefTriggerProps {
51
46
getPopupElement : ( ) => HTMLDivElement ;
52
47
}
@@ -70,7 +65,6 @@ export interface SelectTriggerProps {
70
65
getPopupContainer ?: RenderDOMFunc ;
71
66
dropdownAlign : object ;
72
67
empty : boolean ;
73
- autoAdjustOverflow ?: boolean ;
74
68
75
69
getTriggerDOMNode : ( ) => HTMLElement ;
76
70
onPopupVisibleChange ?: ( visible : boolean ) => void ;
@@ -95,15 +89,14 @@ const SelectTrigger: React.RefForwardingComponent<RefTriggerProps, SelectTrigger
95
89
dropdownClassName,
96
90
direction = 'ltr' ,
97
91
placement,
98
- dropdownMatchSelectWidth = true ,
92
+ dropdownMatchSelectWidth,
99
93
dropdownRender,
100
94
dropdownAlign,
101
95
getPopupContainer,
102
96
empty,
103
97
getTriggerDOMNode,
104
98
onPopupVisibleChange,
105
99
onPopupMouseEnter,
106
- autoAdjustOverflow,
107
100
...restProps
108
101
} = props ;
109
102
@@ -115,11 +108,8 @@ const SelectTrigger: React.RefForwardingComponent<RefTriggerProps, SelectTrigger
115
108
}
116
109
117
110
const builtInPlacements = React . useMemo (
118
- ( ) => getBuiltInPlacements ( getAdjustX ( {
119
- autoAdjustOverflow,
120
- dropdownMatchSelectWidth,
121
- } ) ) ,
122
- [ dropdownMatchSelectWidth , autoAdjustOverflow ] ,
111
+ ( ) => getBuiltInPlacements ( dropdownMatchSelectWidth ) ,
112
+ [ dropdownMatchSelectWidth ] ,
123
113
) ;
124
114
125
115
// ===================== Motion ======================
0 commit comments