Skip to content

Commit

Permalink
optimize picker/date-picker #210
Browse files Browse the repository at this point in the history
  • Loading branch information
warmhug committed Sep 13, 2016
1 parent 1f0dcc4 commit adb5a45
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions components/date-picker/PropsType.tsx
Expand Up @@ -15,6 +15,8 @@ interface DatePickerProps {
prefixCls?: string;
pickerPrefixCls?: string;
popupPrefixCls?: string;
dismissText?: string|React.ReactElement<any>; // React.ReactElement only for web
okText?: string|React.ReactElement<any>; // React.ReactElement only for web
}

export default DatePickerProps;
8 changes: 5 additions & 3 deletions components/date-picker/index.web.tsx
Expand Up @@ -19,7 +19,7 @@ export default class DatePicker extends React.Component<tsPropsType, any> {

render() {
const { props } = this;
const { children, extra, value, defaultDate } = props;
const { children, value, defaultDate, extra, okText, dismissText, popupPrefixCls } = props;
const extraProps = {
extra: value ? formatFn(this, value) : extra,
};
Expand All @@ -37,12 +37,14 @@ export default class DatePicker extends React.Component<tsPropsType, any> {
return (
<PopupDatePicker
datePicker={dataPicker}
{...props}
prefixCls={props.popupPrefixCls}
WrapComponent="div"
transitionName="am-slide-up"
maskTransitionName="am-fade"
{...props}
prefixCls={popupPrefixCls}
date={value || defaultDate}
dismissText={<span className={`${popupPrefixCls}-header-cancel-button`}>{dismissText}</span>}
okText={<span className={`${popupPrefixCls}-header-ok-button`}>{okText}</span>}
>
{React.cloneElement(children,
children.type && children.type.myName === 'ListItem' ? extraProps : {})}
Expand Down
5 changes: 2 additions & 3 deletions components/picker/index.web.tsx
Expand Up @@ -43,7 +43,7 @@ export default class Picker extends React.Component<tsPropsType, any> {

render() {
const {props} = this;
const {children, value, okText, dismissText, title, extra, popupPrefixCls} = props;
const {children, value, extra, okText, dismissText, popupPrefixCls} = props;
const extraProps = {
extra: this.getSel() || extra,
};
Expand All @@ -63,10 +63,9 @@ export default class Picker extends React.Component<tsPropsType, any> {
WrapComponent="div"
transitionName="am-slide-up"
maskTransitionName="am-fade"
{...this.props}
{...props}
prefixCls={popupPrefixCls}
value={value}
title={title}
dismissText={<span className={`${popupPrefixCls}-header-cancel-button`}>{dismissText}</span>}
okText={<span className={`${popupPrefixCls}-header-ok-button`}>{okText}</span>}
>
Expand Down
3 changes: 3 additions & 0 deletions components/picker/style/picker.less
Expand Up @@ -24,6 +24,9 @@
white-space: nowrap;
text-overflow: ellipsis;
direction: rtl;
&-selected {
font-size: @font-size-heading;
}
}

&-mask {
Expand Down

0 comments on commit adb5a45

Please sign in to comment.