@@ -5,10 +5,10 @@ import * as React from 'react';
5
5
import type { Placement , RenderDOMFunc } from './BaseSelect' ;
6
6
7
7
const getBuiltInPlacements = (
8
- dropdownMatchSelectWidth : number | boolean ,
8
+ popupMatchSelectWidth : number | boolean ,
9
9
) : Record < string , AlignType > => {
10
10
// Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
11
- const adjustX = dropdownMatchSelectWidth === true ? 0 : 1 ;
11
+ const adjustX = popupMatchSelectWidth === true ? 0 : 1 ;
12
12
return {
13
13
bottomLeft : {
14
14
points : [ 'tl' , 'bl' ] ,
@@ -64,13 +64,13 @@ export interface SelectTriggerProps {
64
64
transitionName ?: string ;
65
65
placement ?: Placement ;
66
66
builtinPlacements ?: BuildInPlacements ;
67
- dropdownStyle : React . CSSProperties ;
68
- dropdownClassName : string ;
67
+ popupStyle : React . CSSProperties ;
68
+ popupClassName : string ;
69
69
direction : string ;
70
- dropdownMatchSelectWidth ?: boolean | number ;
71
- dropdownRender ?: ( menu : React . ReactElement ) => React . ReactElement ;
70
+ popupMatchSelectWidth ?: boolean | number ;
71
+ popupRender ?: ( menu : React . ReactElement ) => React . ReactElement ;
72
72
getPopupContainer ?: RenderDOMFunc ;
73
- dropdownAlign : AlignType ;
73
+ popupAlign : AlignType ;
74
74
empty : boolean ;
75
75
76
76
getTriggerDOMNode : ( node : HTMLElement ) => HTMLElement ;
@@ -91,14 +91,14 @@ const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTrigg
91
91
popupElement,
92
92
animation,
93
93
transitionName,
94
- dropdownStyle ,
95
- dropdownClassName ,
94
+ popupStyle ,
95
+ popupClassName ,
96
96
direction = 'ltr' ,
97
97
placement,
98
98
builtinPlacements,
99
- dropdownMatchSelectWidth ,
100
- dropdownRender ,
101
- dropdownAlign ,
99
+ popupMatchSelectWidth ,
100
+ popupRender ,
101
+ popupAlign ,
102
102
getPopupContainer,
103
103
empty,
104
104
getTriggerDOMNode,
@@ -107,38 +107,38 @@ const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTrigg
107
107
...restProps
108
108
} = props ;
109
109
110
- const dropdownPrefixCls = `${ prefixCls } -dropdown` ;
110
+ const popupPrefixCls = `${ prefixCls } -dropdown` ;
111
111
112
112
let popupNode = popupElement ;
113
- if ( dropdownRender ) {
114
- popupNode = dropdownRender ( popupElement ) ;
113
+ if ( popupRender ) {
114
+ popupNode = popupRender ( popupElement ) ;
115
115
}
116
116
117
117
const mergedBuiltinPlacements = React . useMemo (
118
- ( ) => builtinPlacements || getBuiltInPlacements ( dropdownMatchSelectWidth ) ,
119
- [ builtinPlacements , dropdownMatchSelectWidth ] ,
118
+ ( ) => builtinPlacements || getBuiltInPlacements ( popupMatchSelectWidth ) ,
119
+ [ builtinPlacements , popupMatchSelectWidth ] ,
120
120
) ;
121
121
122
122
// ===================== Motion ======================
123
- const mergedTransitionName = animation ? `${ dropdownPrefixCls } -${ animation } ` : transitionName ;
123
+ const mergedTransitionName = animation ? `${ popupPrefixCls } -${ animation } ` : transitionName ;
124
124
125
125
// =================== Popup Width ===================
126
- const isNumberPopupWidth = typeof dropdownMatchSelectWidth === 'number' ;
126
+ const isNumberPopupWidth = typeof popupMatchSelectWidth === 'number' ;
127
127
128
128
const stretch = React . useMemo ( ( ) => {
129
129
if ( isNumberPopupWidth ) {
130
130
return null ;
131
131
}
132
132
133
- return dropdownMatchSelectWidth === false ? 'minWidth' : 'width' ;
134
- } , [ dropdownMatchSelectWidth , isNumberPopupWidth ] ) ;
133
+ return popupMatchSelectWidth === false ? 'minWidth' : 'width' ;
134
+ } , [ popupMatchSelectWidth , isNumberPopupWidth ] ) ;
135
135
136
- let popupStyle = dropdownStyle ;
136
+ let mergedPopupStyle = popupStyle ;
137
137
138
138
if ( isNumberPopupWidth ) {
139
- popupStyle = {
139
+ mergedPopupStyle = {
140
140
...popupStyle ,
141
- width : dropdownMatchSelectWidth ,
141
+ width : popupMatchSelectWidth ,
142
142
} ;
143
143
}
144
144
@@ -156,18 +156,18 @@ const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTrigg
156
156
hideAction = { onPopupVisibleChange ? [ 'click' ] : [ ] }
157
157
popupPlacement = { placement || ( direction === 'rtl' ? 'bottomRight' : 'bottomLeft' ) }
158
158
builtinPlacements = { mergedBuiltinPlacements }
159
- prefixCls = { dropdownPrefixCls }
159
+ prefixCls = { popupPrefixCls }
160
160
popupTransitionName = { mergedTransitionName }
161
161
popup = { < div onMouseEnter = { onPopupMouseEnter } > { popupNode } </ div > }
162
162
ref = { triggerPopupRef }
163
163
stretch = { stretch }
164
- popupAlign = { dropdownAlign }
164
+ popupAlign = { popupAlign }
165
165
popupVisible = { visible }
166
166
getPopupContainer = { getPopupContainer }
167
- popupClassName = { classNames ( dropdownClassName , {
168
- [ `${ dropdownPrefixCls } -empty` ] : empty ,
167
+ popupClassName = { classNames ( popupClassName , {
168
+ [ `${ popupPrefixCls } -empty` ] : empty ,
169
169
} ) }
170
- popupStyle = { popupStyle }
170
+ popupStyle = { mergedPopupStyle }
171
171
getTriggerDOMNode = { getTriggerDOMNode }
172
172
onPopupVisibleChange = { onPopupVisibleChange }
173
173
>
0 commit comments