@@ -38,7 +38,7 @@ import { getSeparatedContent } from './utils/valueUtil';
38
38
import useSelectTriggerControl from './hooks/useSelectTriggerControl' ;
39
39
import useCacheDisplayValue from './hooks/useCacheDisplayValue' ;
40
40
import useCacheOptions from './hooks/useCacheOptions' ;
41
- import type { CSSProperties , DefineComponent , PropType , VNode , VNodeChild } from 'vue' ;
41
+ import type { CSSProperties , PropType , VNode , VNodeChild } from 'vue' ;
42
42
import {
43
43
computed ,
44
44
defineComponent ,
@@ -137,7 +137,7 @@ export const BaseProps = () => ({
137
137
maxTagTextLength : PropTypes . number ,
138
138
maxTagCount : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
139
139
maxTagPlaceholder : PropTypes . any ,
140
- tokenSeparators : PropTypes . array ,
140
+ tokenSeparators : PropTypes . arrayOf ( PropTypes . string ) ,
141
141
tagRender : PropTypes . func ,
142
142
showAction : PropTypes . array ,
143
143
tabindex : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
@@ -285,7 +285,10 @@ export interface SelectProps<OptionsType extends object[], ValueType> {
285
285
export interface GenerateConfig < OptionsType extends object [ ] > {
286
286
prefixCls : string ;
287
287
components : {
288
- optionList : DefineComponent < Omit < OptionListProps , 'options' > & { options ?: OptionsType } > ;
288
+ // TODO
289
+ optionList : (
290
+ props : Omit < OptionListProps , 'options' > & { options ?: OptionsType } ,
291
+ ) => JSX . Element ;
289
292
} ;
290
293
/** Convert jsx tree into `OptionsType` */
291
294
convertChildrenToData : ( children : VNodeChild | JSX . Element ) => OptionsType ;
@@ -313,6 +316,7 @@ export interface GenerateConfig<OptionsType extends object[]> {
313
316
) => OptionsType ;
314
317
omitDOMProps ?: ( props : object ) => object ;
315
318
}
319
+
316
320
type ValueType = DefaultValueType ;
317
321
/**
318
322
* This function is in internal usage.
@@ -338,11 +342,12 @@ export default function generateSelector<
338
342
warningProps,
339
343
fillOptionsWithMissingValue,
340
344
omitDOMProps,
341
- } = config as any ;
342
- const Select = defineComponent < SelectProps < OptionsType , ValueType > > ( {
345
+ } = config ;
346
+ const Select = defineComponent ( {
343
347
name : 'Select' ,
344
348
slots : [ 'option' ] ,
345
- setup ( props : SelectProps < OptionsType , ValueType > ) {
349
+ props : initDefaultProps ( BaseProps ( ) , { } ) ,
350
+ setup ( props ) {
346
351
const useInternalProps = computed (
347
352
( ) => props . internalProps && props . internalProps . mark === INTERNAL_PROPS_MARK ,
348
353
) ;
@@ -442,9 +447,9 @@ export default function generateSelector<
442
447
} ) ;
443
448
444
449
const mergedOptions = computed ( ( ) : OptionsType => {
445
- let newOptions = props . options ;
450
+ let newOptions = props . options as OptionsType ;
446
451
if ( newOptions === undefined ) {
447
- newOptions = convertChildrenToData ( props . children ) ;
452
+ newOptions = convertChildrenToData ( props . children as VNodeChild ) ;
448
453
}
449
454
450
455
/**
@@ -733,7 +738,7 @@ export default function generateSelector<
733
738
// Check if match the `tokenSeparators`
734
739
const patchLabels : string [ ] = isCompositing
735
740
? null
736
- : getSeparatedContent ( searchText , props . tokenSeparators ) ;
741
+ : getSeparatedContent ( searchText , props . tokenSeparators as string [ ] ) ;
737
742
let patchRawValues : RawValueType [ ] = patchLabels ;
738
743
739
744
if ( props . mode === 'combobox' ) {
@@ -913,12 +918,12 @@ export default function generateSelector<
913
918
if ( props . disabled ) {
914
919
return ;
915
920
}
916
- const serachVal = mergedSearchValue . value ;
917
- if ( serachVal ) {
921
+ const searchVal = mergedSearchValue . value ;
922
+ if ( searchVal ) {
918
923
// `tags` mode should move `searchValue` into values
919
924
if ( props . mode === 'tags' ) {
920
925
triggerSearch ( '' , false , false ) ;
921
- triggerChange ( Array . from ( new Set ( [ ...mergedRawValue . value , serachVal ] ) ) ) ;
926
+ triggerChange ( Array . from ( new Set ( [ ...mergedRawValue . value , searchVal ] ) ) ) ;
922
927
} else if ( props . mode === 'multiple' ) {
923
928
// `multiple` mode only clean the search value but not trigger event
924
929
setInnerSearchValue ( '' ) ;
@@ -1096,7 +1101,7 @@ export default function generateSelector<
1096
1101
activeValue,
1097
1102
onSearchSubmit,
1098
1103
$slots : slots ,
1099
- } = this as any ;
1104
+ } = this ;
1100
1105
const {
1101
1106
prefixCls = defaultPrefixCls ,
1102
1107
class : className ,
@@ -1356,6 +1361,6 @@ export default function generateSelector<
1356
1361
) ;
1357
1362
} ,
1358
1363
} ) ;
1359
- Select . props = initDefaultProps ( BaseProps ( ) , { } ) ;
1364
+
1360
1365
return Select ;
1361
1366
}
0 commit comments