Skip to content

Commit

Permalink
cascader: suffix -> suffixIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
HeskeyBaozi authored and afc163 committed Sep 21, 2018
1 parent 784984d commit 2d4a6db
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/cascader/demo/suffix.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ function onChange(value) {
ReactDOM.render(
<div>
<Cascader
suffix={<Icon type="smile" />}
suffixIcon={<Icon type="smile" />}
options={options}
onChange={onChange}
placeholder="Please select"
/>
<Cascader
suffix="ab"
suffixIcon="ab"
style={{ marginTop: '1rem' }}
options={options}
onChange={onChange}
Expand Down
2 changes: 1 addition & 1 deletion components/cascader/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Cascade selection box.
| showSearch | Whether show search input in single mode. | boolean\|object | false |
| size | input size, one of `large` `default` `small` | string | `default` |
| style | additional style | string | - |
| suffix | The custom suffix icon | ReactNode | - |
| suffixIcon | The custom suffix icon | ReactNode | - |
| value | selected value | string\[] | - |
| onChange | callback when finishing cascader select | `(value, selectedOptions) => void` | - |
| onPopupVisibleChange | callback when popup shown or hidden | `(value) => void` | - |
Expand Down
14 changes: 7 additions & 7 deletions components/cascader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface CascaderProps {
getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
popupVisible?: boolean;
fieldNames?: FieldNamesType;
suffix?: React.ReactNode;
suffixIcon?: React.ReactNode;
}

export interface CascaderState {
Expand Down Expand Up @@ -342,7 +342,7 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
const { props, state } = this;
const {
prefixCls, inputPrefixCls, children, placeholder, size, disabled,
className, style, allowClear, showSearch = false, suffix, ...otherProps
className, style, allowClear, showSearch = false, suffixIcon, ...otherProps
} = props;
const { value, inputFocused } = state;

Expand Down Expand Up @@ -415,17 +415,17 @@ export default class Cascader extends React.Component<CascaderProps, CascaderSta
dropdownMenuColumnStyle.width = this.input.input.offsetWidth;
}

const inputIcon = suffix && (
React.isValidElement<{ className?: string }>(suffix)
const inputIcon = suffixIcon && (
React.isValidElement<{ className?: string }>(suffixIcon)
? React.cloneElement(
suffix,
suffixIcon,
{
className: classNames({
[suffix.props.className!]: suffix.props.className,
[suffixIcon.props.className!]: suffixIcon.props.className,
[`${prefixCls}-picker-arrow`]: true,
}),
},
) : <span className={`${prefixCls}-picker-arrow`}>{suffix}</span>) || (
) : <span className={`${prefixCls}-picker-arrow`}>{suffixIcon}</span>) || (
<Icon type="down" className={arrowCls} />
);

Expand Down
2 changes: 1 addition & 1 deletion components/cascader/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ subtitle: 级联选择
| showSearch | 在选择框中显示搜索框 | boolean | false |
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
| style | 自定义样式 | string | - |
| suffix | 自定义的选择框后缀图标 | ReactNode | - |
| suffixIcon | 自定义的选择框后缀图标 | ReactNode | - |
| value | 指定选中项 | string\[] | - |
| onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - |
| onPopupVisibleChange | 显示/隐藏浮层的回调 | `(value) => void` | - |
Expand Down

0 comments on commit 2d4a6db

Please sign in to comment.