@@ -38,7 +38,7 @@ import { getSeparatedContent } from './utils/valueUtil';
3838import useSelectTriggerControl from './hooks/useSelectTriggerControl' ;
3939import useCacheDisplayValue from './hooks/useCacheDisplayValue' ;
4040import useCacheOptions from './hooks/useCacheOptions' ;
41- import type { CSSProperties , DefineComponent , PropType , VNode , VNodeChild } from 'vue' ;
41+ import type { CSSProperties , PropType , VNode , VNodeChild } from 'vue' ;
4242import {
4343 computed ,
4444 defineComponent ,
@@ -137,7 +137,7 @@ export const BaseProps = () => ({
137137 maxTagTextLength : PropTypes . number ,
138138 maxTagCount : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
139139 maxTagPlaceholder : PropTypes . any ,
140- tokenSeparators : PropTypes . array ,
140+ tokenSeparators : PropTypes . arrayOf ( PropTypes . string ) ,
141141 tagRender : PropTypes . func ,
142142 showAction : PropTypes . array ,
143143 tabindex : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
@@ -285,7 +285,10 @@ export interface SelectProps<OptionsType extends object[], ValueType> {
285285export interface GenerateConfig < OptionsType extends object [ ] > {
286286 prefixCls : string ;
287287 components : {
288- optionList : DefineComponent < Omit < OptionListProps , 'options' > & { options ?: OptionsType } > ;
288+ // TODO
289+ optionList : (
290+ props : Omit < OptionListProps , 'options' > & { options ?: OptionsType } ,
291+ ) => JSX . Element ;
289292 } ;
290293 /** Convert jsx tree into `OptionsType` */
291294 convertChildrenToData : ( children : VNodeChild | JSX . Element ) => OptionsType ;
@@ -313,6 +316,7 @@ export interface GenerateConfig<OptionsType extends object[]> {
313316 ) => OptionsType ;
314317 omitDOMProps ?: ( props : object ) => object ;
315318}
319+
316320type ValueType = DefaultValueType ;
317321/**
318322 * This function is in internal usage.
@@ -338,11 +342,12 @@ export default function generateSelector<
338342 warningProps,
339343 fillOptionsWithMissingValue,
340344 omitDOMProps,
341- } = config as any ;
342- const Select = defineComponent < SelectProps < OptionsType , ValueType > > ( {
345+ } = config ;
346+ const Select = defineComponent ( {
343347 name : 'Select' ,
344348 slots : [ 'option' ] ,
345- setup ( props : SelectProps < OptionsType , ValueType > ) {
349+ props : initDefaultProps ( BaseProps ( ) , { } ) ,
350+ setup ( props ) {
346351 const useInternalProps = computed (
347352 ( ) => props . internalProps && props . internalProps . mark === INTERNAL_PROPS_MARK ,
348353 ) ;
@@ -442,9 +447,9 @@ export default function generateSelector<
442447 } ) ;
443448
444449 const mergedOptions = computed ( ( ) : OptionsType => {
445- let newOptions = props . options ;
450+ let newOptions = props . options as OptionsType ;
446451 if ( newOptions === undefined ) {
447- newOptions = convertChildrenToData ( props . children ) ;
452+ newOptions = convertChildrenToData ( props . children as VNodeChild ) ;
448453 }
449454
450455 /**
@@ -733,7 +738,7 @@ export default function generateSelector<
733738 // Check if match the `tokenSeparators`
734739 const patchLabels : string [ ] = isCompositing
735740 ? null
736- : getSeparatedContent ( searchText , props . tokenSeparators ) ;
741+ : getSeparatedContent ( searchText , props . tokenSeparators as string [ ] ) ;
737742 let patchRawValues : RawValueType [ ] = patchLabels ;
738743
739744 if ( props . mode === 'combobox' ) {
@@ -913,12 +918,12 @@ export default function generateSelector<
913918 if ( props . disabled ) {
914919 return ;
915920 }
916- const serachVal = mergedSearchValue . value ;
917- if ( serachVal ) {
921+ const searchVal = mergedSearchValue . value ;
922+ if ( searchVal ) {
918923 // `tags` mode should move `searchValue` into values
919924 if ( props . mode === 'tags' ) {
920925 triggerSearch ( '' , false , false ) ;
921- triggerChange ( Array . from ( new Set ( [ ...mergedRawValue . value , serachVal ] ) ) ) ;
926+ triggerChange ( Array . from ( new Set ( [ ...mergedRawValue . value , searchVal ] ) ) ) ;
922927 } else if ( props . mode === 'multiple' ) {
923928 // `multiple` mode only clean the search value but not trigger event
924929 setInnerSearchValue ( '' ) ;
@@ -1096,7 +1101,7 @@ export default function generateSelector<
10961101 activeValue,
10971102 onSearchSubmit,
10981103 $slots : slots ,
1099- } = this as any ;
1104+ } = this ;
11001105 const {
11011106 prefixCls = defaultPrefixCls ,
11021107 class : className ,
@@ -1356,6 +1361,6 @@ export default function generateSelector<
13561361 ) ;
13571362 } ,
13581363 } ) ;
1359- Select . props = initDefaultProps ( BaseProps ( ) , { } ) ;
1364+
13601365 return Select ;
13611366}
0 commit comments