@@ -12,11 +12,13 @@ import { useState, useRef, useEffect, useMemo } from 'react';
1212import KeyCode from 'rc-util/lib/KeyCode' ;
1313import classNames from 'classnames' ;
1414import useMergedState from 'rc-util/lib/hooks/useMergedState' ;
15- import { ScrollTo } from 'rc-virtual-list/lib/List' ;
16- import Selector , { RefSelectorProps } from './Selector' ;
17- import SelectTrigger , { RefTriggerProps } from './SelectTrigger' ;
18- import { RenderNode , Mode , RenderDOMFunc , OnActiveValue } from './interface' ;
19- import {
15+ import type { ScrollTo } from 'rc-virtual-list/lib/List' ;
16+ import type { RefSelectorProps } from './Selector' ;
17+ import Selector from './Selector' ;
18+ import type { RefTriggerProps } from './SelectTrigger' ;
19+ import SelectTrigger from './SelectTrigger' ;
20+ import type { RenderNode , Mode , RenderDOMFunc , OnActiveValue } from './interface' ;
21+ import type {
2022 GetLabeledValue ,
2123 FilterOptions ,
2224 FilterFunc ,
@@ -29,11 +31,12 @@ import {
2931 FlattenOptionsType ,
3032 SingleType ,
3133 OnClear ,
32- INTERNAL_PROPS_MARK ,
3334 SelectSource ,
34- CustomTagProps ,
35+ CustomTagProps } from './interface/generator' ;
36+ import {
37+ INTERNAL_PROPS_MARK
3538} from './interface/generator' ;
36- import { OptionListProps , RefOptionListProps } from './OptionList' ;
39+ import type { OptionListProps , RefOptionListProps } from './OptionList' ;
3740import { toInnerValue , toOuterValues , removeLastEnabledValue , getUUID } from './utils/commonUtil' ;
3841import TransBtn from './TransBtn' ;
3942import useLock from './hooks/useLock' ;
@@ -59,7 +62,7 @@ const DEFAULT_OMIT_PROPS = [
5962export interface RefSelectProps {
6063 focus : ( ) => void ;
6164 blur : ( ) => void ;
62- scrollTo ?: ScrollTo ,
65+ scrollTo ?: ScrollTo ;
6366}
6467
6568export interface SelectProps < OptionsType extends object [ ] , ValueType > extends React . AriaAttributes {
@@ -194,7 +197,7 @@ export interface GenerateConfig<OptionsType extends object[]> {
194197 getLabeledValue : GetLabeledValue < FlattenOptionsType < OptionsType > > ;
195198 filterOptions : FilterOptions < OptionsType > ;
196199 findValueOption : // Need still support legacy ts api
197- | ( ( values : RawValueType [ ] , options : FlattenOptionsType < OptionsType > ) => OptionsType )
200+ | ( ( values : RawValueType [ ] , options : FlattenOptionsType < OptionsType > ) => OptionsType )
198201 // New API add prevValueOptions support
199202 | ( (
200203 values : RawValueType [ ] ,
@@ -327,7 +330,7 @@ export default function generateSelector<
327330 const useInternalProps = internalProps . mark === INTERNAL_PROPS_MARK ;
328331
329332 const domProps = omitDOMProps ? omitDOMProps ( restProps ) : restProps ;
330- DEFAULT_OMIT_PROPS . forEach ( prop => {
333+ DEFAULT_OMIT_PROPS . forEach ( ( prop ) => {
331334 delete domProps [ prop ] ;
332335 } ) ;
333336
@@ -337,7 +340,8 @@ export default function generateSelector<
337340 const listRef = useRef < RefOptionListProps > ( null ) ;
338341
339342 const tokenWithEnter = useMemo (
340- ( ) => ( tokenSeparators || [ ] ) . some ( tokenSeparator => [ '\n' , '\r\n' ] . includes ( tokenSeparator ) ) ,
343+ ( ) =>
344+ ( tokenSeparators || [ ] ) . some ( ( tokenSeparator ) => [ '\n' , '\r\n' ] . includes ( tokenSeparator ) ) ,
341345 [ tokenSeparators ] ,
342346 ) ;
343347
@@ -446,7 +450,7 @@ export default function generateSelector<
446450 } ) ;
447451 if (
448452 mode === 'tags' &&
449- filteredOptions . every ( opt => opt [ optionFilterProp ] !== mergedSearchValue )
453+ filteredOptions . every ( ( opt ) => opt [ optionFilterProp ] !== mergedSearchValue )
450454 ) {
451455 filteredOptions . unshift ( {
452456 value : mergedSearchValue ,
@@ -682,7 +686,7 @@ export default function generateSelector<
682686
683687 if ( mode !== 'tags' ) {
684688 patchRawValues = patchLabels
685- . map ( label => {
689+ . map ( ( label ) => {
686690 const item = mergedFlattenOptions . find (
687691 ( { data } ) => data [ mergedOptionLabelProp ] === label ,
688692 ) ;
@@ -695,7 +699,7 @@ export default function generateSelector<
695699 new Set < RawValueType > ( [ ...mergedRawValue , ...patchRawValues ] ) ,
696700 ) ;
697701 triggerChange ( newRawValues ) ;
698- newRawValues . forEach ( newRawValue => {
702+ newRawValues . forEach ( ( newRawValue ) => {
699703 triggerSelect ( newRawValue , true , 'input' ) ;
700704 } ) ;
701705
@@ -719,9 +723,11 @@ export default function generateSelector<
719723 // If menu is open, OptionList will take charge
720724 // If mode isn't tags, press enter is not meaningful when you can't see any option
721725 const onSearchSubmit = ( searchText : string ) => {
722- const newRawValues = Array . from ( new Set < RawValueType > ( [ ...mergedRawValue , searchText ] ) ) ;
726+ const newRawValues = Array . from (
727+ new Set < RawValueType > ( [ ...mergedRawValue , searchText ] ) ,
728+ ) ;
723729 triggerChange ( newRawValues ) ;
724- newRawValues . forEach ( newRawValue => {
730+ newRawValues . forEach ( ( newRawValue ) => {
725731 triggerSelect ( newRawValue , true , 'input' ) ;
726732 } ) ;
727733 setInnerSearchValue ( '' ) ;
@@ -845,10 +851,10 @@ export default function generateSelector<
845851 }
846852 } ;
847853
848- const activeTimeoutIds : number [ ] = [ ] ;
854+ const activeTimeoutIds : any [ ] = [ ] ;
849855 useEffect (
850856 ( ) => ( ) => {
851- activeTimeoutIds . forEach ( timeoutId => clearTimeout ( timeoutId ) ) ;
857+ activeTimeoutIds . forEach ( ( timeoutId ) => clearTimeout ( timeoutId ) ) ;
852858 activeTimeoutIds . splice ( 0 , activeTimeoutIds . length ) ;
853859 } ,
854860 [ ] ,
0 commit comments