mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
Adds onFocus and onBlur to Select properties. (#7082)
This commit is contained in:
parent
e9b3c36866
commit
18c6860296
@ -21,6 +21,14 @@ function handleChange(value) {
|
||||
console.log(`selected ${value}`);
|
||||
}
|
||||
|
||||
function handleBlur() {
|
||||
console.log('blur');
|
||||
}
|
||||
|
||||
function handleFocus() {
|
||||
console.log('focus');
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Select
|
||||
showSearch
|
||||
@ -28,6 +36,8 @@ ReactDOM.render(
|
||||
placeholder="Select a person"
|
||||
optionFilterProp="children"
|
||||
onChange={handleChange}
|
||||
onFocus={handleFocus}
|
||||
onBlur={handleBlur}
|
||||
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
|
||||
>
|
||||
<Option value="jack">Jack</Option>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import RcSelect, { Option, OptGroup } from 'rc-select';
|
||||
import RcSelect, { Option, OptGroup, SelectPropTypes as RcSelectPropTypes } from 'rc-select';
|
||||
import classNames from 'classnames';
|
||||
import warning from '../_util/warning';
|
||||
|
||||
@ -41,6 +41,8 @@ export interface SelectProps extends AbstractSelectProps {
|
||||
onChange?: (value: SelectValue) => void;
|
||||
onSelect?: (value: SelectValue, option: Object) => any;
|
||||
onDeselect?: (value: SelectValue) => any;
|
||||
onBlur?: () => any;
|
||||
onFocus?: () => any;
|
||||
dropdownMatchSelectWidth?: boolean;
|
||||
optionFilterProp?: string;
|
||||
defaultActiveFirstOption?: boolean;
|
||||
@ -65,6 +67,19 @@ export interface SelectContext {
|
||||
};
|
||||
}
|
||||
|
||||
export const SelectPropTypes = {
|
||||
...RcSelectPropTypes,
|
||||
prefixCls: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
size: PropTypes.oneOf(['default', 'large', 'small']),
|
||||
combobox: PropTypes.bool,
|
||||
notFoundContent: PropTypes.any,
|
||||
showSearch: PropTypes.bool,
|
||||
optionLabelProp: PropTypes.string,
|
||||
transitionName: PropTypes.string,
|
||||
choiceTransitionName: PropTypes.string,
|
||||
};
|
||||
|
||||
// => It is needless to export the declaration of below two inner components.
|
||||
// export { Option, OptGroup };
|
||||
|
||||
@ -79,17 +94,7 @@ export default class Select extends React.Component<SelectProps, any> {
|
||||
choiceTransitionName: 'zoom',
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
prefixCls: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
size: PropTypes.oneOf(['default', 'large', 'small']),
|
||||
combobox: PropTypes.bool,
|
||||
notFoundContent: PropTypes.any,
|
||||
showSearch: PropTypes.bool,
|
||||
optionLabelProp: PropTypes.string,
|
||||
transitionName: PropTypes.string,
|
||||
choiceTransitionName: PropTypes.string,
|
||||
};
|
||||
static propTypes = SelectPropTypes;
|
||||
|
||||
static contextTypes = {
|
||||
antLocale: PropTypes.object,
|
||||
|
Loading…
Reference in New Issue
Block a user