import * as React from 'react' ; import { DatePickerProps } from './type' ; import DatePicker from './DatePicker' ; import PickerPopup from '../picker/PickerPopup' ; export interface PopupDatePickerProps extends DatePickerProps { onChange ? : ( data : any ) => void ; onOk ? : ( data : any ) => void ; onCancel ? : ( ) => void ; show ? : boolean ; title ? : string ; } class PopupDatePicker extends React . Component < PopupDatePickerProps , any > { static defaultProps = { mode : 'datetime' , prefixCls : 'Yep-picker' , pickerPrefixCls : 'Yep-picker-col' , minuteStep : 1 , use12Hours : false , pickerValueProp : 'date' , pickerValueChangeProp : 'onDateChange' , title : '' , className : '' , } ; scrollValue : HTMLDivElement ; setScrollValue = ( v ) => { this . scrollValue = v ; } ; onOk = ( v ) => { const { onChange , onOk } = this . props ; if ( this . scrollValue !== undefined ) { v = this . scrollValue ; } if ( onChange ) { onChange ( v ) ; } if ( onOk ) { onOk ( v ) ; } } ; render ( ) { const { show , onCancel , minuteStep , locale , minDate , maxDate , mode , pickerPrefixCls , prefixCls , value , use12Hours , onValueChange , title , className , } = this . props ; return ( < PickerPopup show = { show } onCancel = { onCancel } onOk = { this . onOk } title = { title } className = { className } picker = { < DatePicker minuteStep = { minuteStep } locale = { locale } minDate = { minDate } maxDate = { maxDate } mode = { mode } pickerPrefixCls = { pickerPrefixCls } prefixCls = { prefixCls } defaultDate = { value || new Date ( ) } use12Hours = { use12Hours } onValueChange = { onValueChange } onScrollChange = { this . setScrollValue } / > } />); } } export default PopupDatePicker ;