mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
Add cascader prop disabled
This commit is contained in:
parent
c8038fde32
commit
105130ddb8
@ -51,7 +51,7 @@ class AntCascader extends React.Component {
|
||||
this.setState({ popupVisible: false });
|
||||
}
|
||||
render() {
|
||||
const { prefixCls, children, placeholder, style, size } = this.props;
|
||||
const { prefixCls, children, placeholder, style, size, disabled } = this.props;
|
||||
const sizeCls = classNames({
|
||||
'ant-input-lg': size === 'large',
|
||||
'ant-input-sm': size === 'small',
|
||||
@ -64,6 +64,10 @@ class AntCascader extends React.Component {
|
||||
[`${prefixCls}-picker-arrow`]: true,
|
||||
[`${prefixCls}-picker-arrow-expand`]: this.state.popupVisible,
|
||||
});
|
||||
const pickerCls = classNames({
|
||||
[`${prefixCls}-picker`]: true,
|
||||
[`${prefixCls}-picker-disabled`]: disabled,
|
||||
});
|
||||
return (
|
||||
<Cascader {...this.props}
|
||||
value={this.state.value}
|
||||
@ -73,11 +77,12 @@ class AntCascader extends React.Component {
|
||||
{children ||
|
||||
<span
|
||||
style={style}
|
||||
className={`${prefixCls}-picker`}>
|
||||
className={pickerCls}>
|
||||
<Input placeholder={placeholder}
|
||||
className={`${prefixCls}-input ant-input ${sizeCls}`}
|
||||
style={{width: '100%'}}
|
||||
value={this.getLabel()}
|
||||
disabled={disabled}
|
||||
readOnly />
|
||||
{clearIcon}
|
||||
<Icon type="down" className={arrowCls} />
|
||||
@ -97,6 +102,7 @@ AntCascader.defaultProps = {
|
||||
displayRender(label) {
|
||||
return label.join(' / ');
|
||||
},
|
||||
disabled: false,
|
||||
size: 'default',
|
||||
onPopupVisibleChange() {},
|
||||
};
|
||||
|
@ -32,3 +32,4 @@
|
||||
| popupClassName | 自定义浮层类名 | string | - |
|
||||
| placeholder | 输入框占位文本 | string | '请选择' |
|
||||
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
|
||||
| disabled | 禁用 | boolean | false |
|
||||
|
@ -40,7 +40,7 @@
|
||||
"object-assign": "~4.0.1",
|
||||
"rc-animate": "~2.0.2",
|
||||
"rc-calendar": "~5.2.0",
|
||||
"rc-cascader": "~0.5.0",
|
||||
"rc-cascader": "~0.6.0",
|
||||
"rc-checkbox": "~1.1.1",
|
||||
"rc-collapse": "~1.4.4",
|
||||
"rc-dialog": "~5.2.2",
|
||||
|
@ -45,6 +45,7 @@
|
||||
height: 12px;
|
||||
margin-top: -6px;
|
||||
line-height: 12px;
|
||||
color: #999;
|
||||
.iconfont-size-under-12px(8px);
|
||||
&:before {
|
||||
transition: transform 0.2s ease;
|
||||
|
Loading…
Reference in New Issue
Block a user