mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
🗑 Remove useless prop searchValue
(#19003)
from typescript and documentation close #18847
This commit is contained in:
parent
913c5bbc47
commit
7961bb335c
@ -4,7 +4,6 @@ import Select from '..';
|
||||
import Icon from '../../icon';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
@ -133,16 +132,4 @@ describe('Select', () => {
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
it('warning if user use `inputValue`', () => {
|
||||
resetWarned();
|
||||
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
mount(<Select inputValue="" />);
|
||||
expect(errorSpy).toHaveBeenLastCalledWith(
|
||||
'Warning: [antd: Select] `inputValue` is deprecated. Please use `searchValue` instead.',
|
||||
);
|
||||
|
||||
errorSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
@ -46,7 +46,6 @@ Select component to select value from options.
|
||||
| optionFilterProp | Which prop value of option will be used for filter if filterOption is true | string | value | |
|
||||
| optionLabelProp | Which prop value of option will render as content of select. [Example](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | `value` for `combobox`, `children` for other modes | |
|
||||
| placeholder | Placeholder of select | string\|ReactNode | - | |
|
||||
| searchValue | Search input value | string | - | 3.23.2 |
|
||||
| showArrow | Whether to show the drop-down arrow | boolean | true | 3.2.1 |
|
||||
| showSearch | Whether show search input in single mode. | boolean | false | |
|
||||
| size | Size of Select input. `default` `large` `small` | string | default | |
|
||||
|
@ -53,9 +53,6 @@ export type SelectValue = string | string[] | number | number[] | LabeledValue |
|
||||
|
||||
export interface SelectProps<T = SelectValue> extends AbstractSelectProps {
|
||||
value?: T;
|
||||
/** @deprecated Use `searchValue` instead. */
|
||||
inputValue?: string;
|
||||
searchValue?: string;
|
||||
defaultValue?: T;
|
||||
mode?: 'default' | 'multiple' | 'tags' | 'combobox' | string;
|
||||
optionLabelProp?: string;
|
||||
@ -139,12 +136,6 @@ export default class Select<T = SelectValue> extends React.Component<SelectProps
|
||||
'it will be removed in next major version, ' +
|
||||
'please use AutoComplete instead',
|
||||
);
|
||||
|
||||
warning(
|
||||
!('inputValue' in props),
|
||||
'Select',
|
||||
'`inputValue` is deprecated. Please use `searchValue` instead.',
|
||||
);
|
||||
}
|
||||
|
||||
getNotFoundContent(renderEmpty: RenderEmptyHandler) {
|
||||
@ -207,8 +198,6 @@ export default class Select<T = SelectValue> extends React.Component<SelectProps
|
||||
clearIcon,
|
||||
menuItemSelectedIcon,
|
||||
showArrow,
|
||||
inputValue,
|
||||
searchValue,
|
||||
...restProps
|
||||
} = this.props;
|
||||
const rest = omit(restProps, ['inputIcon']);
|
||||
@ -270,7 +259,6 @@ export default class Select<T = SelectValue> extends React.Component<SelectProps
|
||||
showArrow={showArrow}
|
||||
{...rest}
|
||||
{...modeConfig}
|
||||
inputValue={searchValue || inputValue}
|
||||
prefixCls={prefixCls}
|
||||
className={cls}
|
||||
optionLabelProp={optionLabelProp || 'children'}
|
||||
|
@ -47,7 +47,6 @@ title: Select
|
||||
| optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索。[示例](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | value | |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) | |
|
||||
| placeholder | 选择框默认文字 | string | - | |
|
||||
| searchValue | 搜索框文本 | string | - | 3.23.2 |
|
||||
| showArrow | 是否显示下拉小箭头 | boolean | true | 3.2.1 |
|
||||
| showSearch | 使单选模式可搜索 | boolean | false | |
|
||||
| size | 选择框大小,可选 `large` `small` | string | default | |
|
||||
|
Loading…
Reference in New Issue
Block a user