@@ -110,21 +110,13 @@ const Select = forwardRefWithStatics(
110110 const [ showPopup , setShowPopup ] = useControlled ( props , 'popupVisible' , onPopupVisibleChange ) ;
111111 const [ inputValue , onInputChange ] = useControlled ( props , 'inputValue' , props . onInputChange ) ;
112112
113- const { currentOptions, setCurrentOptions, tmpPropOptions, valueToOption, selectedOptions } = useOptions (
114- keys ,
115- options ,
116- children ,
117- valueType ,
118- value ,
119- reserveKeyword ,
120- ) ;
113+ const { currentOptions, setCurrentOptions, tmpPropOptions, valueToOption, selectedOptions, flattenedOptions } =
114+ useOptions ( keys , options , children , valueType , value , reserveKeyword ) ;
121115
122116 const onCheckAllChange = useCallback (
123117 ( checkAll : boolean , e : React . MouseEvent < HTMLLIElement > ) => {
124118 const isDisabledCheckAll = ( opt : TdOptionProps ) => opt . checkAll && opt . disabled ;
125- if ( ! multiple || currentOptions . some ( ( opt ) => ! isSelectOptionGroup ( opt ) && isDisabledCheckAll ( opt ) ) ) {
126- return ;
127- }
119+ if ( ! multiple || currentOptions . some ( ( opt ) => ! isSelectOptionGroup ( opt ) && isDisabledCheckAll ( opt ) ) ) return ;
128120
129121 const { valueKey } = getKeyMapping ( keys ) ;
130122 const isObjectType = valueType === 'object' ;
@@ -189,8 +181,8 @@ const Select = forwardRefWithStatics(
189181 [ currentOptions , keys , multiple , onChange , value , valueToOption , valueType ] ,
190182 ) ;
191183
192- const { handleKeyDown, hoverIndex } = useKeyboardControl ( {
193- displayOptions : currentOptions as TdOptionProps [ ] ,
184+ const { handleKeyDown, hoverOption , hoverIndex } = useKeyboardControl ( {
185+ displayOptions : flattenedOptions as TdOptionProps [ ] ,
194186 max,
195187 multiple,
196188 setInnerPopupVisible : setShowPopup ,
@@ -430,7 +422,7 @@ const Select = forwardRefWithStatics(
430422 onCheckAllChange,
431423 getPopupInstance,
432424 scroll,
433- hoverIndex ,
425+ hoverOption ,
434426 } ;
435427 return < PopupContent { ...popupContentProps } > { childrenWithProps } </ PopupContent > ;
436428 } ;
0 commit comments