1
- import type { VNodeChild , App , PropType , Plugin } from 'vue' ;
1
+ import type { App , PropType , Plugin , ExtractPropTypes } from 'vue' ;
2
2
import { computed , defineComponent , ref } from 'vue' ;
3
3
import omit from 'omit.js' ;
4
4
import classNames from '../_util/classNames' ;
5
5
import type { SelectProps as RcSelectProps } from '../vc-select' ;
6
- import RcSelect , { Option , OptGroup , BaseProps } from '../vc-select' ;
6
+ import RcSelect , { Option , OptGroup , selectBaseProps } from '../vc-select' ;
7
7
import type { OptionProps as OptionPropsType } from '../vc-select/Option' ;
8
8
import getIcons from './utils/iconUtil' ;
9
9
import PropTypes from '../_util/vue-types' ;
@@ -20,36 +20,26 @@ export type OptionType = typeof Option;
20
20
export interface LabeledValue {
21
21
key ?: string ;
22
22
value : RawValue ;
23
- label : VNodeChild ;
23
+ label : any ;
24
24
}
25
25
export type SelectValue = RawValue | RawValue [ ] | LabeledValue | LabeledValue [ ] | undefined ;
26
26
27
- export interface InternalSelectProps < VT > extends Omit < RcSelectProps < VT > , 'mode' > {
28
- suffixIcon ?: VNodeChild ;
29
- itemIcon ?: VNodeChild ;
27
+ interface InternalSelectProps < VT > extends Omit < RcSelectProps < VT > , 'mode' > {
28
+ suffixIcon ?: any ;
29
+ itemIcon ?: any ;
30
30
size ?: SizeType ;
31
31
mode ?: 'multiple' | 'tags' | 'SECRET_COMBOBOX_MODE_DO_NOT_USE' ;
32
32
bordered ?: boolean ;
33
33
}
34
34
35
- export interface SelectPropsTypes < VT >
36
- extends Omit <
37
- InternalSelectProps < VT > ,
38
- 'inputIcon' | 'mode' | 'getInputElement' | 'backfill' | 'class' | 'style'
39
- > {
35
+ interface SelectPropsTypes < VT >
36
+ extends Omit < InternalSelectProps < VT > , 'inputIcon' | 'mode' | 'getInputElement' | 'backfill' > {
40
37
mode ?: 'multiple' | 'tags' ;
41
38
}
42
- export type SelectTypes = SelectPropsTypes < SelectValue > ;
43
- export const SelectProps = ( ) => ( {
44
- ...( omit ( BaseProps ( ) , [
45
- 'inputIcon' ,
46
- 'mode' ,
47
- 'getInputElement' ,
48
- 'backfill' ,
49
- 'class' ,
50
- 'style' ,
51
- ] ) as Omit <
52
- ReturnType < typeof BaseProps > ,
39
+ export type SelectProps = Partial < ExtractPropTypes < SelectPropsTypes < SelectValue > > > ;
40
+ export const selectProps = ( ) => ( {
41
+ ...( omit ( selectBaseProps ( ) , [ 'inputIcon' , 'mode' , 'getInputElement' , 'backfill' ] ) as Omit <
42
+ SelectPropsTypes < SelectValue > ,
53
43
'inputIcon' | 'mode' | 'getInputElement' | 'backfill' | 'class' | 'style'
54
44
> ) ,
55
45
value : {
@@ -58,9 +48,9 @@ export const SelectProps = () => ({
58
48
defaultValue : {
59
49
type : [ Array , Object , String , Number ] as PropType < SelectValue > ,
60
50
} ,
61
- notFoundContent : PropTypes . VNodeChild ,
62
- suffixIcon : PropTypes . VNodeChild ,
63
- itemIcon : PropTypes . VNodeChild ,
51
+ notFoundContent : PropTypes . any ,
52
+ suffixIcon : PropTypes . any ,
53
+ itemIcon : PropTypes . any ,
64
54
size : PropTypes . oneOf ( tuple ( 'small' , 'middle' , 'large' , 'default' ) ) ,
65
55
mode : PropTypes . oneOf ( tuple ( 'multiple' , 'tags' , 'SECRET_COMBOBOX_MODE_DO_NOT_USE' ) ) ,
66
56
bordered : PropTypes . looseBool . def ( true ) ,
@@ -73,7 +63,7 @@ const Select = defineComponent({
73
63
Option,
74
64
OptGroup,
75
65
inheritAttrs : false ,
76
- props : SelectProps ( ) ,
66
+ props : selectProps ( ) ,
77
67
SECRET_COMBOBOX_MODE_DO_NOT_USE : 'SECRET_COMBOBOX_MODE_DO_NOT_USE' ,
78
68
emits : [ 'change' , 'update:value' ] ,
79
69
slots : [
@@ -146,7 +136,7 @@ const Select = defineComponent({
146
136
const isMultiple = mode . value === 'multiple' || mode . value === 'tags' ;
147
137
148
138
// ===================== Empty =====================
149
- let mergedNotFound : VNodeChild ;
139
+ let mergedNotFound : any ;
150
140
if ( notFoundContent !== undefined ) {
151
141
mergedNotFound = notFoundContent ;
152
142
} else if ( slots . notFoundContent ) {
0 commit comments