import _defineProperty from 'babel-runtime/helpers/defineProperty';
var _jsxFileName = 'src/datePicker/components/dateRangeUnity.jsx';
/**
 * dateRangeUnity.jsx
 *
 * @Author: apple
 * @Date: 2018/6/29 11:17
 */

import React from 'react';
import Tooltip from '../../tooltip';
import Separator from '../separator';
import ConvientRange from '../convientRange';
import PropTypes from 'prop-types';
import classNames from 'classnames';

function DateRangeUnity(props) {
    var prefixClsDatePicker = props.prefixClsDatePicker,
        dateRangeWholeStyle = props.dateRangeWholeStyle,
        beginTimeValue = props.beginTimeValue,
        inputProps = props.inputProps,
        separator = props.separator,
        endTimeValue = props.endTimeValue,
        clearBtn = props.clearBtn,
        convenientRange = props.convenientRange,
        inputClass = props.inputClass,
        dateRangeOpen = props.dateRangeOpen,
        beginDtItemDiffProps = props.beginDtItemDiffProps,
        endDtItemDiffProps = props.endDtItemDiffProps,
        renderInput = props.renderInput,
        handleActive = props.handleActive,
        renderDtItem = props.renderDtItem,
        handleSelectRange = props.handleSelectRange,
        selectRangeBar = props.selectRangeBar,
        _autoTest_isOpen = props._autoTest_isOpen;

    var prefixClsDatePickerUnity = prefixClsDatePicker + '-unity-inputs';
    var clsDatePickerUnityFocus = prefixClsDatePickerUnity + '-focus';
    var clsDatePickerUnityItem = prefixClsDatePickerUnity + '-item';
    var dprInputsClass = classNames(prefixClsDatePickerUnity, _defineProperty({}, clsDatePickerUnityFocus, dateRangeOpen));
    var inputsClass = classNames(clsDatePickerUnityItem, inputClass);
    // const endInputsClass = classNames(clsDatePickerUnityItem, endInputClass);
    var prefixSlideCls = prefixClsDatePicker + '-panel-slide-bar';
    var readyRenderInput = renderInput();
    var readyRenderDtItem = renderDtItem();
    return React.createElement(
        'div',
        { className: prefixClsDatePicker, __source: {
                fileName: _jsxFileName,
                lineNumber: 48
            },
            __self: this
        },
        React.createElement(
            Tooltip,
            {
                position: 'bottom',
                trigger: 'click',
                className: 'dp-panel',
                autoAdjustPosition: true,
                isOpen: _autoTest_isOpen,
                content: React.createElement(
                    'div',
                    {
                        className: dprInputsClass,
                        style: dateRangeWholeStyle,
                        onMouseEnter: function onMouseEnter() {
                            return handleActive(true);
                        },
                        onMouseLeave: function onMouseLeave() {
                            return handleActive(false);
                        }, __source: {
                            fileName: _jsxFileName,
                            lineNumber: 56
                        },
                        __self: this
                    },
                    readyRenderInput({
                        defaultValue: beginTimeValue,
                        inputProps: inputProps[0],
                        className: inputsClass
                    }),
                    React.createElement(Separator, { prefixClsDatePicker: prefixClsDatePicker, separator: separator, __source: {
                            fileName: _jsxFileName,
                            lineNumber: 66
                        },
                        __self: this
                    }),
                    readyRenderInput({
                        defaultValue: endTimeValue,
                        inputProps: inputProps[1],
                        className: inputsClass
                    }),
                    clearBtn()
                ), __source: {
                    fileName: _jsxFileName,
                    lineNumber: 49
                },
                __self: this
            },
            React.createElement(
                'div',
                { className: prefixClsDatePicker + '-panel', __source: {
                        fileName: _jsxFileName,
                        lineNumber: 75
                    },
                    __self: this
                },
                convenientRange && React.createElement(ConvientRange, {
                    convenientRange: convenientRange,
                    prefixSlideCls: prefixSlideCls,
                    handleSelectRange: handleSelectRange,
                    selectRangeBar: selectRangeBar,
                    __source: {
                        fileName: _jsxFileName,
                        lineNumber: 77
                    },
                    __self: this
                }),
                readyRenderDtItem(beginDtItemDiffProps),
                readyRenderDtItem(endDtItemDiffProps)
            )
        )
    );
}

Date.propTypes = {
    prefixClsDatePicker: PropTypes.string,
    onlyTimeValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.instanceOf(Date)]),
    beginTimeValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.instanceOf(Date)]),
    endTimeValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.instanceOf(Date)]),
    inputProps: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
    inputClass: PropTypes.string,
    clearBtn: PropTypes.func,
    beginDisableExquisiteTimeRules: PropTypes.object,
    endDisableExquisiteTimeRules: PropTypes.object,
    type: PropTypes.string,
    renderDtItem: PropTypes.func,
    renderInput: PropTypes.func,
    onActive: PropTypes.bool,
    beginDtItemDiffProps: PropTypes.object,
    endDtItemDiffProps: PropTypes.object
};

export default DateRangeUnity;