( props, ref, )
| 80 | } |
| 81 | |
| 82 | const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTriggerProps> = ( |
| 83 | props, |
| 84 | ref, |
| 85 | ) => { |
| 86 | const { |
| 87 | prefixCls, |
| 88 | disabled, |
| 89 | visible, |
| 90 | children, |
| 91 | popupElement, |
| 92 | animation, |
| 93 | transitionName, |
| 94 | dropdownStyle, |
| 95 | dropdownClassName, |
| 96 | direction = 'ltr', |
| 97 | placement, |
| 98 | builtinPlacements, |
| 99 | dropdownMatchSelectWidth, |
| 100 | dropdownRender, |
| 101 | dropdownAlign, |
| 102 | getPopupContainer, |
| 103 | empty, |
| 104 | getTriggerDOMNode, |
| 105 | onPopupVisibleChange, |
| 106 | onPopupMouseEnter, |
| 107 | ...restProps |
| 108 | } = props; |
| 109 | |
| 110 | const dropdownPrefixCls = `${prefixCls}-dropdown`; |
| 111 | |
| 112 | let popupNode = popupElement; |
| 113 | if (dropdownRender) { |
| 114 | popupNode = dropdownRender(popupElement); |
| 115 | } |
| 116 | |
| 117 | const mergedBuiltinPlacements = React.useMemo( |
| 118 | () => builtinPlacements || getBuiltInPlacements(dropdownMatchSelectWidth), |
| 119 | [builtinPlacements, dropdownMatchSelectWidth], |
| 120 | ); |
| 121 | |
| 122 | // ===================== Motion ====================== |
| 123 | const mergedTransitionName = animation ? `${dropdownPrefixCls}-${animation}` : transitionName; |
| 124 | |
| 125 | // =================== Popup Width =================== |
| 126 | const isNumberPopupWidth = typeof dropdownMatchSelectWidth === 'number'; |
| 127 | |
| 128 | const stretch = React.useMemo(() => { |
| 129 | if (isNumberPopupWidth) { |
| 130 | return null; |
| 131 | } |
| 132 | |
| 133 | return dropdownMatchSelectWidth === false ? 'minWidth' : 'width'; |
| 134 | }, [dropdownMatchSelectWidth, isNumberPopupWidth]); |
| 135 | |
| 136 | let popupStyle = dropdownStyle; |
| 137 | |
| 138 | if (isNumberPopupWidth) { |
| 139 | popupStyle = { |
nothing calls this directly
no test coverage detected
searching dependent graphs…