@@ -12,24 +12,28 @@ import styled from 'styled-components';
12
12
13
13
import { fontSizeFromTheme } from '../styled-utils' ;
14
14
15
- export type OptionType < TValue = unknown > = {
15
+ export type OptionType < TValue = unknown > =
16
+ | ValueOptionType < TValue >
17
+ | GroupedOptionType < TValue > ;
18
+
19
+ export type ValueOptionType < TValue = unknown > = {
16
20
label : ReactNode ;
17
21
value : TValue ;
22
+ disabled ?: boolean ;
18
23
} ;
19
24
20
25
/** As described in https://4x.ant.design/components/select/#components-select-demo-optgroup. */
21
26
export type GroupedOptionType < TValue = unknown > = {
22
27
label : ReactNode ;
23
- options : Array < OptionType < TValue > > ;
28
+ options : Array < ValueOptionType < TValue > > ;
29
+ disabled ?: boolean ;
24
30
} ;
25
31
26
32
export type { FilterFunc as FilterOptionFunction } from 'rc-select/es/Select' ;
27
33
28
34
export type SelectProps <
29
35
TValue = unknown ,
30
- TOption extends
31
- | OptionType < TValue >
32
- | GroupedOptionType < TValue > = OptionType < TValue > ,
36
+ TOption extends OptionType < TValue > = OptionType < TValue > ,
33
37
> = AntdSelectProps < TValue , TOption > & RefAttributes < BaseSelectRef > ;
34
38
35
39
const StyledSelect = styled ( AntdSelect ) `
@@ -58,10 +62,7 @@ const StyledDropdown = styled.div`
58
62
}
59
63
` ;
60
64
61
- function SelectInner <
62
- TValue ,
63
- TOptionType extends OptionType < TValue > | GroupedOptionType < TValue > ,
64
- > (
65
+ function SelectInner < TValue , TOptionType extends OptionType < TValue > > (
65
66
{ children, dropdownRender, ...props } : SelectProps < TValue , TOptionType > ,
66
67
ref : ForwardedRef < BaseSelectRef > ,
67
68
) {
@@ -87,9 +88,7 @@ function SelectInner<
87
88
88
89
export const Select = forwardRef ( SelectInner ) as unknown as ( <
89
90
TValue = unknown ,
90
- TOptionType extends
91
- | OptionType < TValue >
92
- | GroupedOptionType < TValue > = OptionType < TValue > ,
91
+ TOptionType extends OptionType < TValue > = OptionType < TValue > ,
93
92
> (
94
93
props : SelectProps < TValue , TOptionType > & RefAttributes < BaseSelectRef > ,
95
94
) => ReactElement ) & {
0 commit comments