Skip to content

Commit

Permalink
Merge bee6bbe into 04629b5
Browse files Browse the repository at this point in the history
  • Loading branch information
warmhug committed Aug 29, 2016
2 parents 04629b5 + bee6bbe commit cbed21b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/popup.tsx
Expand Up @@ -80,7 +80,7 @@ class Demo extends React.Component<any, any> {
locale={props.locale}
onPickerChange={this.onPickerChange}
onDismiss={this.onDismiss}
onChange={this.onChange}
onChange={this.onChange} data-xx="xxdd"
>
<button onClick={this.show}>{date && format(date) || 'open'}</button>
</PopPicker>
Expand Down
2 changes: 1 addition & 1 deletion examples/simple.tsx
Expand Up @@ -65,7 +65,7 @@ class Demo extends React.Component<any, any> {
locale={props.locale}
maxDate={maxDate}
minDate={minDate}
onDateChange={this.onDateChange}
onDateChange={this.onDateChange} data-xx="xxdd"
/>
</div>
</div>);
Expand Down
2 changes: 1 addition & 1 deletion examples/time.tsx
Expand Up @@ -69,7 +69,7 @@ class Demo extends React.Component<any, any> {
locale={props.locale}
maxDate={maxDate}
minDate={minDate}
onDateChange={this.onDateChange}
onDateChange={this.onDateChange} data-xx="xxdd"
/>
</div>
</div>);
Expand Down
19 changes: 15 additions & 4 deletions src/DatePicker.web.tsx
Expand Up @@ -4,14 +4,24 @@ import classnames from 'classnames';
import {DatePickerProps, DatePickerState} from './DatePickerTypes';
import DatePickerMixin from './DatePickerMixin';

function getDataAttr(props) {
const dataAttrs = {};
Object.keys(props).forEach(i => {
if (i.indexOf('data-') === 0) {
dataAttrs[i] = props[i];
}
});
return dataAttrs;
}

const DatePickerWeb = React.createClass<DatePickerProps, DatePickerState> ({
mixins: [DatePickerMixin],

getDefaultProps() {
return {
prefixCls: 'rmc-date-picker',
pickerPrefixCls: 'rmc-picker',
};
pickerPrefixCls: 'rmc-picker',
};
},

render() {
Expand All @@ -25,14 +35,15 @@ const DatePickerWeb = React.createClass<DatePickerProps, DatePickerState> ({
prefixCls={pickerPrefixCls}
pure={false}
selectedValue={value[i]}
onValueChange={(v) => {this.onValueChange(i, v);}}
onValueChange={(v) => { this.onValueChange(i, v); }}
disabled={props.disabled || false}
>
{items}
</Picker>
</div>);
});

return (<div className={classnames(className, prefixCls)}>
return (<div {...getDataAttr(props)} className={classnames(className, prefixCls)}>
{inner}
</div>);
},
Expand Down
1 change: 1 addition & 0 deletions src/DatePickerTypes.tsx
Expand Up @@ -6,6 +6,7 @@ export interface DatePickerProps {
mode?: string;
locale?: any;
onDateChange?: (date: any) => void;
disabled?:boolean;
/** web only */
prefixCls?:string;
/** web only */
Expand Down

0 comments on commit cbed21b

Please sign in to comment.