Skip to content

Commit

Permalink
timepicker: 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 a2520b0 commit 006b274
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion components/time-picker/demo/suffix.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function onChange(time, timeString) {
const icon = <Icon type="smile" />;

ReactDOM.render(
<TimePicker suffix={icon} onChange={onChange} defaultOpenValue={moment('00:00:00', 'HH:mm:ss')} />,
<TimePicker suffixIcon={icon} onChange={onChange} defaultOpenValue={moment('00:00:00', 'HH:mm:ss')} />,
mountNode
);
````
2 changes: 1 addition & 1 deletion components/time-picker/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import moment from 'moment';
| placeholder | display when there's no value | string | "Select a time" |
| popupClassName | className of panel | string | '' |
| secondStep | interval between seconds in picker | number | 1 |
| suffix | The custom suffix icon | ReactNode | - |
| suffixIcon | The custom suffix icon | ReactNode | - |
| use12Hours | display as 12 hours format, with default format `h:mm:ss a` | boolean | false |
| value | to set time | [moment](http://momentjs.com/) | - |
| onChange | a callback function, can be executed when the selected time is changing | function(time: moment, timeString: string): void | - |
Expand Down
14 changes: 7 additions & 7 deletions components/time-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface TimePickerProps {
clearText?: string;
defaultOpenValue?: moment.Moment;
popupClassName?: string;
suffix?: React.ReactNode;
suffixIcon?: React.ReactNode;
}

export interface TimePickerLocale {
Expand Down Expand Up @@ -154,18 +154,18 @@ class TimePicker extends React.Component<TimePickerProps, any> {
) : null
);

const { suffix, prefixCls } = props;
const clockIcon = suffix && (
React.isValidElement<{ className?: string }>(suffix)
const { suffixIcon, prefixCls } = props;
const clockIcon = 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}-clock-icon`]: true,
}),
},
) : <span className={`${prefixCls}-clock-icon`}>{suffix}</span>) || (
) : <span className={`${prefixCls}-clock-icon`}>{suffixIcon}</span>) || (
<Icon
type="clock-circle"
className={`${prefixCls}-clock-icon`}
Expand Down
2 changes: 1 addition & 1 deletion components/time-picker/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import moment from 'moment';
| placeholder | 没有值的时候显示的内容 | string | "请选择时间" |
| popupClassName | 弹出层类名 | string | '' |
| secondStep | 秒选项间隔 | number | 1 |
| suffix | 自定义的选择框后缀图标 | ReactNode | - |
| suffixIcon | 自定义的选择框后缀图标 | ReactNode | - |
| use12Hours | 使用 12 小时制,为 true 时 `format` 默认为 `h:mm:ss a` | boolean | false |
| value | 当前时间 | [moment](http://momentjs.com/) ||
| onChange | 时间发生变化的回调 | function(time: moment, timeString: string): void ||
Expand Down

0 comments on commit 006b274

Please sign in to comment.