diff --git a/components/cascader/demo/custom-render.md b/components/cascader/demo/custom-render.md index fb68b4e525..13e3a1c798 100644 --- a/components/cascader/demo/custom-render.md +++ b/components/cascader/demo/custom-render.md @@ -64,7 +64,7 @@ ReactDOM.render( options={options} defaultValue={['zhejiang', 'hangzhou', 'xihu']} displayRender={displayRender} - style={{ width: 200 }} + style={{ width: 270 }} /> , mountNode); ```` diff --git a/components/cascader/demo/search.md b/components/cascader/demo/search.md index 994a88575f..f63675c981 100644 --- a/components/cascader/demo/search.md +++ b/components/cascader/demo/search.md @@ -49,7 +49,6 @@ ReactDOM.render( options={options} onChange={onChange} placeholder="Please select" - style={{ width: 230 }} showSearch />, mountNode diff --git a/components/cascader/index.en-US.md b/components/cascader/index.en-US.md index fba0952e17..6fc6cd1063 100644 --- a/components/cascader/index.en-US.md +++ b/components/cascader/index.en-US.md @@ -48,3 +48,8 @@ Fields in `showSearch`: | sort | Used to sort filtered options. | `function(a, b, inputValue)` | | | matchInputWidth | Whether the width of result list equals to input's | boolean | | + diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index ddc946f491..839c20c100 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -144,6 +144,7 @@ export default class Cascader extends React.Component { this.setState({ popupVisible, inputFocused: popupVisible, + inputValue: popupVisible ? this.state.inputValue : '', }); this.props.onPopupVisibleChange(popupVisible); } @@ -256,6 +257,7 @@ export default class Cascader extends React.Component { const pickerCls = classNames({ [className]: !!className, [`${prefixCls}-picker`]: true, + [`${prefixCls}-picker-with-value`]: state.inputValue, [`${prefixCls}-picker-disabled`]: disabled, }); diff --git a/components/cascader/index.zh-CN.md b/components/cascader/index.zh-CN.md index eaa79b54cf..dd99b11009 100644 --- a/components/cascader/index.zh-CN.md +++ b/components/cascader/index.zh-CN.md @@ -48,3 +48,9 @@ subtitle: 级联选择 | render | 用于渲染 filter 后的选项 | `function(inputValue, path): React.ReactNode` | | | sort | 用于排序 filter 后的选项 | `function(a, b, inputValue)` | | | matchInputWidth | 搜索结果列表是否与输入框同宽 | boolean | | + + diff --git a/components/cascader/style/index.less b/components/cascader/style/index.less index de9cf3e05e..20e15b437b 100644 --- a/components/cascader/style/index.less +++ b/components/cascader/style/index.less @@ -11,8 +11,6 @@ cursor: pointer; width: 100%; z-index: 1; - background: transparent; - color: transparent; } &-picker { position: relative; @@ -23,6 +21,10 @@ background-color: #fff; border-radius: @border-radius-base; + &-with-value &-label { + color: transparent; + } + &-disabled { cursor: not-allowed; diff --git a/components/form/demo/validate-customized.md b/components/form/demo/validate-customized.md index b72010b57f..9f1b3a46ae 100644 --- a/components/form/demo/validate-customized.md +++ b/components/form/demo/validate-customized.md @@ -176,7 +176,7 @@ let Demo = React.createClass({ {this.state.rePassBarShow ? this.renderPassStrengthBar('rePass') : null} - + );