@@ -128,7 +128,7 @@ export interface SelectProps<OptionsType extends object[], ValueType> extends Re
128
128
choiceTransitionName ?: string ;
129
129
}
130
130
131
- export interface GenerateConfig < OptionsType extends object [ ] , StaticProps > {
131
+ export interface GenerateConfig < OptionsType extends object [ ] > {
132
132
prefixCls : string ;
133
133
components : {
134
134
optionList : React . ForwardRefExoticComponent <
@@ -138,7 +138,6 @@ export interface GenerateConfig<OptionsType extends object[], StaticProps> {
138
138
React . RefAttributes < RefOptionListProps >
139
139
> ;
140
140
} ;
141
- staticProps ?: StaticProps ;
142
141
/** Convert jsx tree into `OptionsType` */
143
142
convertChildrenToData : ( children : React . ReactNode ) => OptionsType ;
144
143
/** Flatten nest options into raw option list */
@@ -171,13 +170,11 @@ export default function generateSelector<
171
170
label ?: React . ReactNode ;
172
171
key ?: Key ;
173
172
disabled ?: boolean ;
174
- } [ ] ,
175
- StaticProps
176
- > ( config : GenerateConfig < OptionsType , StaticProps > ) {
173
+ } [ ]
174
+ > ( config : GenerateConfig < OptionsType > ) {
177
175
const {
178
176
prefixCls : defaultPrefixCls ,
179
177
components : { optionList : OptionList } ,
180
- staticProps,
181
178
convertChildrenToData,
182
179
flattenOptions,
183
180
getLabeledValue,
@@ -852,32 +849,5 @@ export default function generateSelector<
852
849
type RefSelectFuncType = typeof RefSelectFunc ;
853
850
const RefSelect = ( ( React . forwardRef as unknown ) as RefSelectFuncType ) ( Select ) ;
854
851
855
- /**
856
- * Typescript not support generic with function component,
857
- * we have to wrap an class component to handle this.
858
- */
859
- class ClassSelect < VT > extends React . Component < SelectProps < OptionsType , VT > > {
860
- selectRef = React . createRef < RefSelectProps > ( ) ;
861
-
862
- focus = ( ) => {
863
- this . selectRef . current . focus ( ) ;
864
- } ;
865
-
866
- blur = ( ) => {
867
- this . selectRef . current . blur ( ) ;
868
- } ;
869
-
870
- render ( ) {
871
- return < RefSelect ref = { this . selectRef } { ...this . props } /> ;
872
- }
873
- }
874
-
875
- // Inject static props
876
- if ( staticProps ) {
877
- Object . keys ( staticProps ) . forEach ( prop => {
878
- ClassSelect [ prop ] = staticProps [ prop ] ;
879
- } ) ;
880
- }
881
-
882
- return ClassSelect as ( typeof ClassSelect & StaticProps ) ;
852
+ return RefSelect ;
883
853
}
0 commit comments