Skip to content

Commit a06ff88

Browse files
authored
fix(Select): exclude internal popup visibility callback (#59142)
1 parent bebea8a commit a06ff88

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

‎components/auto-complete/AutoComplete.tsx‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ export interface AutoCompleteProps<
5858
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
5959
> extends Omit<
6060
InternalSelectProps<ValueType, OptionType>,
61-
'loading' | 'mode' | 'optionLabelProp' | 'labelInValue' | 'styles' | 'classNames' | 'showSearch' | 'optionFilterProp' | 'filterSort'
61+
| 'loading'
62+
| 'mode'
63+
| 'optionLabelProp'
64+
| 'labelInValue'
65+
| 'styles'
66+
| 'classNames'
67+
| 'showSearch'
68+
| 'optionFilterProp'
69+
| 'filterSort'
6270
> {
6371
/** @deprecated Please use `options` instead */
6472
dataSource?: DataSourceItemType[];
@@ -80,7 +88,12 @@ export interface AutoCompleteProps<
8088
/** @deprecated Please use `onOpenChange` instead */
8189
onDropdownVisibleChange?: (visible: boolean) => void;
8290
onOpenChange?: (visible: boolean) => void;
83-
showSearch?: boolean | Pick<SearchConfig<OptionType> & { searchIcon?: React.ReactNode }, 'filterOption' | 'onSearch' | 'searchIcon'>;
91+
showSearch?:
92+
| boolean
93+
| Pick<
94+
SearchConfig<OptionType> & { searchIcon?: React.ReactNode },
95+
'filterOption' | 'onSearch' | 'searchIcon'
96+
>;
8497
}
8598

8699
function isSelectOptionOrSelectOptGroup(child: any): boolean {
@@ -251,13 +264,19 @@ const AutoComplete: React.ForwardRefRenderFunction<RefSelectProps, AutoCompleteP
251264
<Select
252265
ref={ref}
253266
suffixIcon={null}
254-
{...omit(props, ['dataSource', 'dropdownClassName', 'popupClassName'])}
267+
{...omit(props, [
268+
'dataSource',
269+
'dropdownClassName',
270+
'popupClassName',
271+
'onDropdownVisibleChange',
272+
'onOpenChange',
273+
])}
255274
prefixCls={prefixCls}
256275
classNames={finalClassNames}
257276
styles={finalStyles}
258277
mode={Select.SECRET_COMBOBOX_MODE_DO_NOT_USE as SelectProps['mode']}
259278
popupRender={mergedPopupRender}
260-
onPopupVisibleChange={mergedOnOpenChange}
279+
onOpenChange={mergedOnOpenChange}
261280
popupMatchSelectWidth={mergedPopupMatchSelectWidth}
262281
{...{
263282
// Internal api

‎components/select/index.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export type SelectValue = RawValue | RawValue[] | LabeledValue | LabeledValue[]
100100
export interface InternalSelectProps<
101101
ValueType = any,
102102
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
103-
> extends Omit<RcSelectProps<ValueType, OptionType>, 'mode' | 'styles' | 'classNames'> {
103+
> extends Omit<
104+
RcSelectProps<ValueType, OptionType>,
105+
'mode' | 'styles' | 'classNames' | 'onPopupVisibleChange'
106+
> {
104107
rootClassName?: string;
105108
prefix?: React.ReactNode;
106109
suffixIcon?: React.ReactNode;
@@ -150,7 +153,7 @@ export interface SelectProps<
150153
/** @deprecated Please use `popupRender` instead */
151154
dropdownRender?: SelectProps['popupRender'];
152155
/** @deprecated Please use `onOpenChange` instead */
153-
onDropdownVisibleChange?: SelectProps['onPopupVisibleChange'];
156+
onDropdownVisibleChange?: RcSelectProps<ValueType, OptionType>['onPopupVisibleChange'];
154157
/** @deprecated Please use `popupMatchSelectWidth` instead */
155158
dropdownMatchSelectWidth?: boolean | number;
156159
popupMatchSelectWidth?: boolean | number;

0 commit comments

Comments
 (0)