mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
chore: Bump Select related deps (#33364)
* chore: bump select related version * test: Fix test case * chore: bump rc-select version * test: Update snapshot * chore: Update Select ts * test: Update snapshot * test: Update snapshot * test: Update snapshot * chore: Update ts definition * chore: fix internal ts def * test: update auto complete snapshot * chore: update snapshot * chore: bump version * chore: fix demo ts * chore: Move ValueType to the first place * test: Update test case
This commit is contained in:
parent
fb286612d5
commit
ff88851c4c
@ -257,7 +257,6 @@ exports[`renders ./components/auto-complete/demo/form-debug.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -343,7 +342,6 @@ exports[`renders ./components/auto-complete/demo/form-debug.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -537,7 +535,6 @@ exports[`renders ./components/auto-complete/demo/form-debug.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -678,7 +675,6 @@ exports[`renders ./components/auto-complete/demo/form-debug.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -828,7 +824,6 @@ exports[`renders ./components/auto-complete/demo/form-debug.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -10,7 +10,13 @@ import * as React from 'react';
|
||||
import toArray from 'rc-util/lib/Children/toArray';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import Select, { InternalSelectProps, OptionType, RefSelectProps } from '../select';
|
||||
import type { BaseSelectRef } from 'rc-select';
|
||||
import Select, {
|
||||
BaseOptionType,
|
||||
DefaultOptionType,
|
||||
InternalSelectProps,
|
||||
RefSelectProps,
|
||||
} from '../select';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { isValidElement } from '../_util/reactNode';
|
||||
@ -23,9 +29,11 @@ export interface DataSourceItemObject {
|
||||
}
|
||||
export type DataSourceItemType = DataSourceItemObject | React.ReactNode;
|
||||
|
||||
export interface AutoCompleteProps
|
||||
extends Omit<
|
||||
InternalSelectProps<string>,
|
||||
export interface AutoCompleteProps<
|
||||
ValueType = any,
|
||||
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
|
||||
> extends Omit<
|
||||
InternalSelectProps<ValueType, OptionType>,
|
||||
'inputIcon' | 'loading' | 'mode' | 'optionLabelProp' | 'labelInValue'
|
||||
> {
|
||||
dataSource?: DataSourceItemType[];
|
||||
@ -129,12 +137,19 @@ const AutoComplete: React.ForwardRefRenderFunction<RefSelectProps, AutoCompleteP
|
||||
);
|
||||
};
|
||||
|
||||
const RefAutoComplete = React.forwardRef<RefSelectProps, AutoCompleteProps>(AutoComplete);
|
||||
|
||||
type RefAutoCompleteWithOption = typeof RefAutoComplete & {
|
||||
Option: OptionType;
|
||||
const RefAutoComplete = React.forwardRef<RefSelectProps, AutoCompleteProps>(
|
||||
AutoComplete,
|
||||
) as unknown as (<
|
||||
ValueType = any,
|
||||
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
|
||||
>(
|
||||
props: React.PropsWithChildren<AutoCompleteProps<ValueType, OptionType>> & {
|
||||
ref?: React.Ref<BaseSelectRef>;
|
||||
},
|
||||
) => React.ReactElement) & {
|
||||
Option: typeof Option;
|
||||
};
|
||||
|
||||
(RefAutoComplete as RefAutoCompleteWithOption).Option = Option;
|
||||
RefAutoComplete.Option = Option;
|
||||
|
||||
export default RefAutoComplete as RefAutoCompleteWithOption;
|
||||
export default RefAutoComplete;
|
||||
|
@ -20,16 +20,8 @@ interface SharedProps<DateType> {
|
||||
}
|
||||
|
||||
function YearSelect<DateType>(props: SharedProps<DateType>) {
|
||||
const {
|
||||
fullscreen,
|
||||
validRange,
|
||||
generateConfig,
|
||||
locale,
|
||||
prefixCls,
|
||||
value,
|
||||
onChange,
|
||||
divRef,
|
||||
} = props;
|
||||
const { fullscreen, validRange, generateConfig, locale, prefixCls, value, onChange, divRef } =
|
||||
props;
|
||||
|
||||
const year = generateConfig.getYear(value || generateConfig.getNow());
|
||||
|
||||
@ -82,16 +74,8 @@ function YearSelect<DateType>(props: SharedProps<DateType>) {
|
||||
}
|
||||
|
||||
function MonthSelect<DateType>(props: SharedProps<DateType>) {
|
||||
const {
|
||||
prefixCls,
|
||||
fullscreen,
|
||||
validRange,
|
||||
value,
|
||||
generateConfig,
|
||||
locale,
|
||||
onChange,
|
||||
divRef,
|
||||
} = props;
|
||||
const { prefixCls, fullscreen, validRange, value, generateConfig, locale, onChange, divRef } =
|
||||
props;
|
||||
const month = generateConfig.getMonth(value || generateConfig.getNow());
|
||||
|
||||
let start = 0;
|
||||
|
@ -11,7 +11,6 @@ exports[`renders ./components/cascader/demo/basic.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -72,7 +71,6 @@ exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] =
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -131,7 +129,6 @@ exports[`renders ./components/cascader/demo/custom-dropdown.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -193,7 +190,6 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -303,7 +299,6 @@ exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -391,7 +386,6 @@ exports[`renders ./components/cascader/demo/disabled-option.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -450,7 +444,6 @@ exports[`renders ./components/cascader/demo/fields-name.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -511,7 +504,6 @@ exports[`renders ./components/cascader/demo/hover.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -570,7 +562,6 @@ exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -638,7 +629,6 @@ exports[`renders ./components/cascader/demo/multiple.md correctly 1`] = `
|
||||
style="width:0"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -679,7 +669,6 @@ exports[`renders ./components/cascader/demo/search.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -738,7 +727,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -796,7 +784,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -854,7 +841,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -917,7 +903,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -977,7 +962,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -1019,7 +1003,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -1079,7 +1062,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -16,7 +16,7 @@ exports[`Cascader can be selected 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -52,7 +52,7 @@ exports[`Cascader can be selected 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -93,7 +93,7 @@ exports[`Cascader can be selected 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -148,7 +148,7 @@ exports[`Cascader can be selected 2`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -184,7 +184,7 @@ exports[`Cascader can be selected 2`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -225,7 +225,7 @@ exports[`Cascader can be selected 2`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -266,7 +266,7 @@ exports[`Cascader can be selected 2`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
role="menuitemcheckbox"
|
||||
title="West Lake"
|
||||
>
|
||||
@ -298,7 +298,7 @@ exports[`Cascader can be selected 3`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -334,7 +334,7 @@ exports[`Cascader can be selected 3`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -375,7 +375,7 @@ exports[`Cascader can be selected 3`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -416,7 +416,7 @@ exports[`Cascader can be selected 3`] = `
|
||||
<li
|
||||
aria-checked="true"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
role="menuitemcheckbox"
|
||||
title="West Lake"
|
||||
>
|
||||
@ -448,7 +448,7 @@ exports[`Cascader can be selected in RTL direction 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -484,7 +484,7 @@ exports[`Cascader can be selected in RTL direction 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -525,7 +525,7 @@ exports[`Cascader can be selected in RTL direction 1`] = `
|
||||
<li
|
||||
aria-checked="true"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -580,7 +580,7 @@ exports[`Cascader can be selected in RTL direction 2`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -616,7 +616,7 @@ exports[`Cascader can be selected in RTL direction 2`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -657,7 +657,7 @@ exports[`Cascader can be selected in RTL direction 2`] = `
|
||||
<li
|
||||
aria-checked="true"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -698,7 +698,7 @@ exports[`Cascader can be selected in RTL direction 2`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
role="menuitemcheckbox"
|
||||
title="West Lake"
|
||||
>
|
||||
@ -730,7 +730,7 @@ exports[`Cascader can be selected in RTL direction 3`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -766,7 +766,7 @@ exports[`Cascader can be selected in RTL direction 3`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -807,7 +807,7 @@ exports[`Cascader can be selected in RTL direction 3`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -848,7 +848,7 @@ exports[`Cascader can be selected in RTL direction 3`] = `
|
||||
<li
|
||||
aria-checked="true"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
role="menuitemcheckbox"
|
||||
title="West Lake"
|
||||
>
|
||||
@ -880,7 +880,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -916,7 +916,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -957,7 +957,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
|
||||
<li
|
||||
aria-checked="true"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -998,7 +998,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
role="menuitemcheckbox"
|
||||
title="West Lake"
|
||||
>
|
||||
@ -1025,7 +1025,6 @@ exports[`Cascader popup correctly with defaultValue RTL 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="rc_select_TEST_OR_SSR_list"
|
||||
aria-expanded="true"
|
||||
@ -1065,7 +1064,7 @@ exports[`Cascader popup correctly with defaultValue RTL 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang"
|
||||
data-path-key="zhejiang"
|
||||
role="menuitemcheckbox"
|
||||
title="Zhejiang"
|
||||
>
|
||||
@ -1101,7 +1100,7 @@ exports[`Cascader popup correctly with defaultValue RTL 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand"
|
||||
data-value="jiangsu"
|
||||
data-path-key="jiangsu"
|
||||
role="menuitemcheckbox"
|
||||
title="Jiangsu"
|
||||
>
|
||||
@ -1142,7 +1141,7 @@ exports[`Cascader popup correctly with defaultValue RTL 1`] = `
|
||||
<li
|
||||
aria-checked="true"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-expand ant-cascader-menu-item-active"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou"
|
||||
role="menuitemcheckbox"
|
||||
title="Hangzhou"
|
||||
>
|
||||
@ -1183,7 +1182,7 @@ exports[`Cascader popup correctly with defaultValue RTL 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
role="menuitemcheckbox"
|
||||
title="West Lake"
|
||||
>
|
||||
@ -1264,7 +1263,6 @@ exports[`Cascader rtl render component should be rendered correctly in RTL direc
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="rc_select_TEST_OR_SSR_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -1329,7 +1327,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item"
|
||||
data-value="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
data-path-key="zhejiang__RC_CASCADER_SPLIT__hangzhou__RC_CASCADER_SPLIT__xihu"
|
||||
role="menuitemcheckbox"
|
||||
>
|
||||
<div
|
||||
@ -1352,7 +1350,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1`
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item"
|
||||
data-value="jiangsu__RC_CASCADER_SPLIT__nanjing__RC_CASCADER_SPLIT__zhonghuamen"
|
||||
data-path-key="jiangsu__RC_CASCADER_SPLIT__nanjing__RC_CASCADER_SPLIT__zhonghuamen"
|
||||
role="menuitemcheckbox"
|
||||
>
|
||||
<div
|
||||
@ -1389,7 +1387,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader wi
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item"
|
||||
data-value="Zhejiang__RC_CASCADER_SPLIT__Hangzhou__RC_CASCADER_SPLIT__West Lake"
|
||||
data-path-key="Zhejiang__RC_CASCADER_SPLIT__Hangzhou__RC_CASCADER_SPLIT__West Lake"
|
||||
role="menuitemcheckbox"
|
||||
>
|
||||
<div
|
||||
@ -1412,7 +1410,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader wi
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-disabled"
|
||||
data-value="Zhejiang__RC_CASCADER_SPLIT__Hangzhou__RC_CASCADER_SPLIT__Xia Sha"
|
||||
data-path-key="Zhejiang__RC_CASCADER_SPLIT__Hangzhou__RC_CASCADER_SPLIT__Xia Sha"
|
||||
role="menuitemcheckbox"
|
||||
>
|
||||
<div
|
||||
@ -1440,7 +1438,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader wi
|
||||
|
||||
exports[`Cascader should render not found content 1`] = `
|
||||
<div
|
||||
class="ant-select-dropdown ant-cascader-dropdown ant-slide-up-appear ant-slide-up-appear-prepare ant-slide-up"
|
||||
class="ant-select-dropdown ant-cascader-dropdown ant-select-dropdown-empty ant-slide-up-appear ant-slide-up-appear-prepare ant-slide-up"
|
||||
style="opacity: 0; pointer-events: none; min-width: 0;"
|
||||
>
|
||||
<div>
|
||||
@ -1454,7 +1452,7 @@ exports[`Cascader should render not found content 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-disabled"
|
||||
data-value="__EMPTY__"
|
||||
data-path-key="__EMPTY__"
|
||||
role="menuitemcheckbox"
|
||||
>
|
||||
<div
|
||||
@ -1530,7 +1528,7 @@ exports[`Cascader should show not found content when options.length is 0 1`] = `
|
||||
<li
|
||||
aria-checked="false"
|
||||
class="ant-cascader-menu-item ant-cascader-menu-item-disabled"
|
||||
data-value="__EMPTY__"
|
||||
data-path-key="__EMPTY__"
|
||||
role="menuitemcheckbox"
|
||||
>
|
||||
<div
|
||||
@ -1601,7 +1599,6 @@ exports[`Cascader support controlled mode 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="rc_select_TEST_OR_SSR_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { mount } from 'enzyme';
|
||||
import * as React from 'react';
|
||||
import Cascader, { BasicDataNode } from '..';
|
||||
import Cascader, { BaseOptionType } from '..';
|
||||
|
||||
describe('Cascader.typescript', () => {
|
||||
it('options value', () => {
|
||||
@ -50,7 +50,7 @@ describe('Cascader.typescript', () => {
|
||||
});
|
||||
|
||||
it('Generic', () => {
|
||||
interface MyOptionData extends BasicDataNode {
|
||||
interface MyOptionData extends BaseOptionType {
|
||||
customizeLabel: string;
|
||||
customizeValue: string;
|
||||
customizeChildren?: MyOptionData[];
|
||||
|
@ -1,8 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import RcCascader from 'rc-cascader';
|
||||
import type { CascaderProps as RcCascaderProps } from 'rc-cascader';
|
||||
import type { ShowSearchType, FieldNames, DataNode } from 'rc-cascader/lib/interface';
|
||||
import type {
|
||||
CascaderProps as RcCascaderProps,
|
||||
ShowSearchType,
|
||||
FieldNames,
|
||||
BaseOptionType,
|
||||
DefaultOptionType,
|
||||
} from 'rc-cascader';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import RightOutlined from '@ant-design/icons/RightOutlined';
|
||||
import RedoOutlined from '@ant-design/icons/RedoOutlined';
|
||||
@ -19,7 +24,7 @@ import { getTransitionName } from '../_util/motion';
|
||||
// - Hover opacity style
|
||||
// - Search filter match case
|
||||
|
||||
export type BasicDataNode = Omit<DataNode, 'label' | 'value' | 'children'>;
|
||||
export { BaseOptionType, DefaultOptionType };
|
||||
|
||||
export type FieldNamesType = FieldNames;
|
||||
|
||||
@ -237,8 +242,8 @@ const Cascader = React.forwardRef((props: CascaderProps<any>, ref: React.Ref<Cas
|
||||
ref={ref}
|
||||
/>
|
||||
);
|
||||
}) as (<DataNodeType extends BasicDataNode | DataNode = DataNode>(
|
||||
props: React.PropsWithChildren<CascaderProps<DataNodeType>> & { ref?: React.Ref<CascaderRef> },
|
||||
}) as (<OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(
|
||||
props: React.PropsWithChildren<CascaderProps<OptionType>> & { ref?: React.Ref<CascaderRef> },
|
||||
) => React.ReactElement) & {
|
||||
displayName: string;
|
||||
};
|
||||
|
@ -9977,7 +9977,6 @@ exports[`ConfigProvider components Cascader configProvider 1`] = `
|
||||
class="config-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -10033,7 +10032,6 @@ exports[`ConfigProvider components Cascader configProvider componentSize large 1
|
||||
class="config-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -10089,7 +10087,6 @@ exports[`ConfigProvider components Cascader configProvider componentSize middle
|
||||
class="config-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -10145,7 +10142,6 @@ exports[`ConfigProvider components Cascader configProvider virtual and dropdownM
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -10201,7 +10197,6 @@ exports[`ConfigProvider components Cascader normal 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -10257,7 +10252,6 @@ exports[`ConfigProvider components Cascader prefixCls 1`] = `
|
||||
class="prefix-Cascader-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -21047,7 +21041,7 @@ exports[`ConfigProvider components Select configProvider 1`] = `
|
||||
<div
|
||||
aria-selected="false"
|
||||
id="undefined_list_0"
|
||||
role="option"
|
||||
role="presentation"
|
||||
/>
|
||||
<div
|
||||
aria-label="Light"
|
||||
@ -21174,7 +21168,7 @@ exports[`ConfigProvider components Select configProvider componentSize large 1`]
|
||||
<div
|
||||
aria-selected="false"
|
||||
id="undefined_list_0"
|
||||
role="option"
|
||||
role="presentation"
|
||||
/>
|
||||
<div
|
||||
aria-label="Light"
|
||||
@ -21301,7 +21295,7 @@ exports[`ConfigProvider components Select configProvider componentSize middle 1`
|
||||
<div
|
||||
aria-selected="false"
|
||||
id="undefined_list_0"
|
||||
role="option"
|
||||
role="presentation"
|
||||
/>
|
||||
<div
|
||||
aria-label="Light"
|
||||
@ -21428,7 +21422,7 @@ exports[`ConfigProvider components Select configProvider virtual and dropdownMat
|
||||
<div
|
||||
aria-selected="false"
|
||||
id="undefined_list_0"
|
||||
role="option"
|
||||
role="presentation"
|
||||
/>
|
||||
<div
|
||||
aria-label="Light"
|
||||
@ -21555,7 +21549,7 @@ exports[`ConfigProvider components Select normal 1`] = `
|
||||
<div
|
||||
aria-selected="false"
|
||||
id="undefined_list_0"
|
||||
role="option"
|
||||
role="presentation"
|
||||
/>
|
||||
<div
|
||||
aria-label="Light"
|
||||
@ -21682,7 +21676,7 @@ exports[`ConfigProvider components Select prefixCls 1`] = `
|
||||
<div
|
||||
aria-selected="false"
|
||||
id="undefined_list_0"
|
||||
role="option"
|
||||
role="presentation"
|
||||
/>
|
||||
<div
|
||||
aria-label="Light"
|
||||
@ -36511,7 +36505,6 @@ exports[`ConfigProvider components TreeSelect configProvider 1`] = `
|
||||
class="config-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-expanded="true"
|
||||
@ -36648,7 +36641,6 @@ exports[`ConfigProvider components TreeSelect configProvider componentSize large
|
||||
class="config-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-expanded="true"
|
||||
@ -36785,7 +36777,6 @@ exports[`ConfigProvider components TreeSelect configProvider componentSize middl
|
||||
class="config-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-expanded="true"
|
||||
@ -36922,7 +36913,6 @@ exports[`ConfigProvider components TreeSelect configProvider virtual and dropdow
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-expanded="true"
|
||||
@ -37059,7 +37049,6 @@ exports[`ConfigProvider components TreeSelect normal 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-expanded="true"
|
||||
@ -37196,7 +37185,6 @@ exports[`ConfigProvider components TreeSelect prefixCls 1`] = `
|
||||
class="prefix-TreeSelect-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-expanded="true"
|
||||
|
@ -173,7 +173,6 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -233,7 +232,6 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -3791,7 +3791,6 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="register_residence_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="register_residence_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -4938,7 +4937,6 @@ exports[`renders ./components/form/demo/size.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -5020,7 +5018,6 @@ exports[`renders ./components/form/demo/size.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -7840,7 +7837,6 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -449,7 +449,6 @@ exports[`renders ./components/input-number/demo/addon.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -272,7 +272,6 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -666,7 +665,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -722,7 +720,6 @@ Array [
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -2387,7 +2384,6 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -547,9 +547,6 @@ exports[`List.pagination should change page size work 2`] = `
|
||||
<div
|
||||
style="position: absolute; top: 0px; left: 0px; width: 100%;"
|
||||
/>
|
||||
<div
|
||||
style="position: absolute; top: 0px; left: 0px; width: 100%;"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -56,7 +56,7 @@ describe('Select', () => {
|
||||
<Select mode={Select.SECRET_COMBOBOX_MODE_DO_NOT_USE} notFoundContent="not at all" />,
|
||||
);
|
||||
toggleOpen(wrapper);
|
||||
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
|
||||
const dropdownWrapper = wrapper.find('Trigger');
|
||||
expect(dropdownWrapper.find('.ant-select-item-option').length).toBeFalsy();
|
||||
expect(dropdownWrapper.find('.ant-select-item-empty').at(0).text()).toBe('not at all');
|
||||
});
|
||||
@ -68,18 +68,18 @@ describe('Select', () => {
|
||||
<Option value="1">1</Option>
|
||||
</Select>,
|
||||
);
|
||||
let dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
|
||||
expect(dropdownWrapper.props().visible).toBe(true);
|
||||
let dropdownWrapper = wrapper.find('Trigger');
|
||||
expect(dropdownWrapper.prop('popupVisible')).toBe(true);
|
||||
toggleOpen(wrapper);
|
||||
expect(onDropdownVisibleChange).toHaveBeenLastCalledWith(false);
|
||||
expect(dropdownWrapper.props().visible).toBe(true);
|
||||
expect(dropdownWrapper.prop('popupVisible')).toBe(true);
|
||||
|
||||
wrapper.setProps({ open: false });
|
||||
dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
|
||||
expect(dropdownWrapper.props().visible).toBe(false);
|
||||
dropdownWrapper = wrapper.find('Trigger');
|
||||
expect(dropdownWrapper.prop('popupVisible')).toBe(false);
|
||||
toggleOpen(wrapper);
|
||||
expect(onDropdownVisibleChange).toHaveBeenLastCalledWith(true);
|
||||
expect(dropdownWrapper.props().visible).toBe(false);
|
||||
expect(dropdownWrapper.prop('popupVisible')).toBe(false);
|
||||
});
|
||||
|
||||
it('should show search icon when showSearch and open', () => {
|
||||
|
@ -25,7 +25,7 @@ export interface DebounceSelectProps<ValueType = any>
|
||||
}
|
||||
|
||||
function DebounceSelect<
|
||||
ValueType extends { key?: string; label: React.ReactNode; value: string | number } = any
|
||||
ValueType extends { key?: string; label: React.ReactNode; value: string | number } = any,
|
||||
>({ fetchOptions, debounceTimeout = 800, ...props }: DebounceSelectProps) {
|
||||
const [fetching, setFetching] = React.useState(false);
|
||||
const [options, setOptions] = React.useState<ValueType[]>([]);
|
||||
|
@ -3,7 +3,8 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import classNames from 'classnames';
|
||||
import RcSelect, { Option, OptGroup, SelectProps as RcSelectProps } from 'rc-select';
|
||||
import RcSelect, { Option, OptGroup, SelectProps as RcSelectProps, BaseSelectRef } from 'rc-select';
|
||||
import type { BaseOptionType, DefaultOptionType } from 'rc-select/lib/Select';
|
||||
import { OptionProps } from 'rc-select/lib/Option';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import getIcons from './utils/iconUtil';
|
||||
@ -12,9 +13,7 @@ import { getTransitionName } from '../_util/motion';
|
||||
|
||||
type RawValue = string | number;
|
||||
|
||||
export { OptionProps };
|
||||
|
||||
export type OptionType = typeof Option;
|
||||
export { OptionProps, BaseSelectRef as RefSelectProps, BaseOptionType, DefaultOptionType };
|
||||
|
||||
export interface LabeledValue {
|
||||
key?: string;
|
||||
@ -24,29 +23,29 @@ export interface LabeledValue {
|
||||
|
||||
export type SelectValue = RawValue | RawValue[] | LabeledValue | LabeledValue[] | undefined;
|
||||
|
||||
export interface InternalSelectProps<VT> extends Omit<RcSelectProps<VT>, 'mode'> {
|
||||
export interface InternalSelectProps<
|
||||
ValueType = any,
|
||||
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
|
||||
> extends Omit<RcSelectProps<ValueType, OptionType>, 'mode'> {
|
||||
suffixIcon?: React.ReactNode;
|
||||
size?: SizeType;
|
||||
mode?: 'multiple' | 'tags' | 'SECRET_COMBOBOX_MODE_DO_NOT_USE';
|
||||
bordered?: boolean;
|
||||
}
|
||||
|
||||
export interface SelectProps<VT>
|
||||
extends Omit<
|
||||
InternalSelectProps<VT>,
|
||||
export interface SelectProps<
|
||||
ValueType = any,
|
||||
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
|
||||
> extends Omit<
|
||||
InternalSelectProps<ValueType, OptionType>,
|
||||
'inputIcon' | 'mode' | 'getInputElement' | 'getRawInputElement' | 'backfill'
|
||||
> {
|
||||
mode?: 'multiple' | 'tags';
|
||||
}
|
||||
|
||||
export interface RefSelectProps {
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
}
|
||||
|
||||
const SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE';
|
||||
|
||||
const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
const InternalSelect = <OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(
|
||||
{
|
||||
prefixCls: customizePrefixCls,
|
||||
bordered = true,
|
||||
@ -58,8 +57,8 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
size: customizeSize,
|
||||
notFoundContent,
|
||||
...props
|
||||
}: SelectProps<VT>,
|
||||
ref: React.Ref<RefSelectProps>,
|
||||
}: SelectProps<OptionType>,
|
||||
ref: React.Ref<BaseSelectRef>,
|
||||
) => {
|
||||
const {
|
||||
getPopupContainer: getContextPopupContainer,
|
||||
@ -75,7 +74,7 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
const rootPrefixCls = getPrefixCls();
|
||||
|
||||
const mode = React.useMemo(() => {
|
||||
const { mode: m } = props as InternalSelectProps<VT>;
|
||||
const { mode: m } = props as InternalSelectProps<OptionType>;
|
||||
|
||||
if ((m as any) === 'combobox') {
|
||||
return undefined;
|
||||
@ -125,7 +124,7 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
);
|
||||
|
||||
return (
|
||||
<RcSelect<VT>
|
||||
<RcSelect<any, any>
|
||||
ref={ref as any}
|
||||
virtual={virtual}
|
||||
dropdownMatchSelectWidth={dropdownMatchSelectWidth}
|
||||
@ -133,7 +132,7 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
transitionName={getTransitionName(rootPrefixCls, 'slide-up', props.transitionName)}
|
||||
listHeight={listHeight}
|
||||
listItemHeight={listItemHeight}
|
||||
mode={mode}
|
||||
mode={mode as any}
|
||||
prefixCls={prefixCls}
|
||||
direction={direction}
|
||||
inputIcon={suffixIcon}
|
||||
@ -148,19 +147,18 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
);
|
||||
};
|
||||
|
||||
const SelectRef = React.forwardRef(InternalSelect) as <VT extends SelectValue = SelectValue>(
|
||||
props: SelectProps<VT> & { ref?: React.Ref<RefSelectProps> },
|
||||
) => React.ReactElement;
|
||||
|
||||
type InternalSelectType = typeof SelectRef;
|
||||
|
||||
interface SelectInterface extends InternalSelectType {
|
||||
const Select = React.forwardRef(InternalSelect) as unknown as (<
|
||||
ValueType = any,
|
||||
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
|
||||
>(
|
||||
props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & {
|
||||
ref?: React.Ref<BaseSelectRef>;
|
||||
},
|
||||
) => React.ReactElement) & {
|
||||
SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
|
||||
Option: typeof Option;
|
||||
OptGroup: typeof OptGroup;
|
||||
}
|
||||
|
||||
const Select = SelectRef as SelectInterface;
|
||||
};
|
||||
|
||||
Select.SECRET_COMBOBOX_MODE_DO_NOT_USE = SECRET_COMBOBOX_MODE_DO_NOT_USE;
|
||||
Select.Option = Option;
|
||||
|
@ -394,7 +394,7 @@ describe('Table.pagination', () => {
|
||||
);
|
||||
wrapper.find('.ant-select-selector').simulate('mousedown');
|
||||
jest.runAllTimers();
|
||||
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
|
||||
const dropdownWrapper = wrapper.find('Trigger');
|
||||
expect(wrapper.find('.ant-select-item-option').length).toBe(4);
|
||||
dropdownWrapper.find('.ant-select-item-option').at(3).simulate('click');
|
||||
expect(onShowSizeChange).toHaveBeenCalledTimes(1);
|
||||
@ -451,7 +451,7 @@ describe('Table.pagination', () => {
|
||||
}),
|
||||
);
|
||||
wrapper.find('.ant-select-selector').simulate('mousedown');
|
||||
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
|
||||
const dropdownWrapper = wrapper.find('Trigger');
|
||||
dropdownWrapper.find('.ant-select-item-option').at(2).simulate('click');
|
||||
|
||||
expect(onChange).toBeCalledTimes(1);
|
||||
|
@ -12,7 +12,6 @@ exports[`renders ./components/tree-select/demo/async.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -74,7 +73,6 @@ exports[`renders ./components/tree-select/demo/basic.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -182,7 +180,6 @@ exports[`renders ./components/tree-select/demo/checkable.md correctly 1`] = `
|
||||
style="width:0"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -212,7 +209,6 @@ exports[`renders ./components/tree-select/demo/checkable.md correctly 1`] = `
|
||||
exports[`renders ./components/tree-select/demo/multiple.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-select ant-tree-select ant-select-multiple ant-select-allow-clear ant-select-show-search"
|
||||
multiple=""
|
||||
style="width:100%"
|
||||
>
|
||||
<div
|
||||
@ -230,7 +226,6 @@ exports[`renders ./components/tree-select/demo/multiple.md correctly 1`] = `
|
||||
style="width:0"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -274,7 +269,6 @@ exports[`renders ./components/tree-select/demo/suffix.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -333,7 +327,6 @@ exports[`renders ./components/tree-select/demo/treeData.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -441,7 +434,6 @@ exports[`renders ./components/tree-select/demo/treeLine.md correctly 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="undefined_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="undefined_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -11,7 +11,6 @@ exports[`TreeSelect TreeSelect Custom Icons should \`treeIcon\` work 1`] = `
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="rc_select_TEST_OR_SSR_list"
|
||||
aria-expanded="true"
|
||||
@ -214,7 +213,6 @@ exports[`TreeSelect TreeSelect Custom Icons should support customized icons 1`]
|
||||
style="width: 0px;"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="rc_select_TEST_OR_SSR_list"
|
||||
aria-haspopup="listbox"
|
||||
@ -263,7 +261,6 @@ exports[`TreeSelect rtl render component should be rendered correctly in RTL dir
|
||||
class="ant-select-selection-search"
|
||||
>
|
||||
<input
|
||||
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
|
||||
aria-autocomplete="list"
|
||||
aria-controls="rc_select_TEST_OR_SSR_list"
|
||||
aria-haspopup="listbox"
|
||||
|
@ -8,7 +8,8 @@ import RcTreeSelect, {
|
||||
} from 'rc-tree-select';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import { DefaultValueType } from 'rc-tree-select/lib/interface';
|
||||
import type { BaseOptionType, DefaultOptionType } from 'rc-tree-select/lib/TreeSelect';
|
||||
import type { BaseSelectRef } from 'rc-select';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { AntTreeNodeProps, TreeProps } from '../tree';
|
||||
@ -27,9 +28,11 @@ export interface LabeledValue {
|
||||
|
||||
export type SelectValue = RawValue | RawValue[] | LabeledValue | LabeledValue[];
|
||||
|
||||
export interface TreeSelectProps<T>
|
||||
extends Omit<
|
||||
RcTreeSelectProps<T>,
|
||||
export interface TreeSelectProps<
|
||||
ValueType = any,
|
||||
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
|
||||
> extends Omit<
|
||||
RcTreeSelectProps<ValueType, OptionType>,
|
||||
| 'showTreeIcon'
|
||||
| 'treeMotion'
|
||||
| 'inputIcon'
|
||||
@ -44,12 +47,7 @@ export interface TreeSelectProps<T>
|
||||
treeLine?: TreeProps['showLine'];
|
||||
}
|
||||
|
||||
export interface RefTreeSelectProps {
|
||||
focus: () => void;
|
||||
blur: () => void;
|
||||
}
|
||||
|
||||
const InternalTreeSelect = <T extends DefaultValueType>(
|
||||
const InternalTreeSelect = <OptionType extends BaseOptionType | DefaultOptionType = BaseOptionType>(
|
||||
{
|
||||
prefixCls: customizePrefixCls,
|
||||
size: customizeSize,
|
||||
@ -68,8 +66,8 @@ const InternalTreeSelect = <T extends DefaultValueType>(
|
||||
transitionName,
|
||||
choiceTransitionName = '',
|
||||
...props
|
||||
}: TreeSelectProps<T>,
|
||||
ref: React.Ref<RefTreeSelectProps>,
|
||||
}: TreeSelectProps<OptionType>,
|
||||
ref: React.Ref<BaseSelectRef>,
|
||||
) => {
|
||||
const {
|
||||
getPopupContainer: getContextPopupContainer,
|
||||
@ -166,8 +164,13 @@ const InternalTreeSelect = <T extends DefaultValueType>(
|
||||
);
|
||||
};
|
||||
|
||||
const TreeSelectRef = React.forwardRef(InternalTreeSelect) as <T extends DefaultValueType>(
|
||||
props: TreeSelectProps<T> & { ref?: React.Ref<RefTreeSelectProps> },
|
||||
const TreeSelectRef = React.forwardRef(InternalTreeSelect) as <
|
||||
ValueType = any,
|
||||
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
|
||||
>(
|
||||
props: React.PropsWithChildren<TreeSelectProps<ValueType, OptionType>> & {
|
||||
ref?: React.Ref<BaseSelectRef>;
|
||||
},
|
||||
) => React.ReactElement;
|
||||
|
||||
type InternalTreeSelectType = typeof TreeSelectRef;
|
||||
|
@ -121,7 +121,7 @@
|
||||
"lodash": "^4.17.21",
|
||||
"memoize-one": "^6.0.0",
|
||||
"moment": "^2.25.3",
|
||||
"rc-cascader": "~2.3.0",
|
||||
"rc-cascader": "~3.0.0-alpha.3",
|
||||
"rc-checkbox": "~2.3.0",
|
||||
"rc-collapse": "~3.1.0",
|
||||
"rc-dialog": "~8.6.0",
|
||||
@ -139,7 +139,7 @@
|
||||
"rc-progress": "~3.1.0",
|
||||
"rc-rate": "~2.9.0",
|
||||
"rc-resize-observer": "^1.1.2",
|
||||
"rc-select": "~13.2.1",
|
||||
"rc-select": "~14.0.0-alpha.15",
|
||||
"rc-slider": "~9.7.4",
|
||||
"rc-steps": "~4.1.0",
|
||||
"rc-switch": "~3.2.0",
|
||||
@ -147,8 +147,8 @@
|
||||
"rc-tabs": "~11.10.0",
|
||||
"rc-textarea": "~0.3.0",
|
||||
"rc-tooltip": "~5.1.1",
|
||||
"rc-tree": "~5.3.0",
|
||||
"rc-tree-select": "~4.8.0",
|
||||
"rc-tree": "~5.3.5",
|
||||
"rc-tree-select": "~5.0.0-alpha.2",
|
||||
"rc-trigger": "^5.2.10",
|
||||
"rc-upload": "~4.3.0",
|
||||
"rc-util": "^5.14.0",
|
||||
|
Loading…
Reference in New Issue
Block a user