function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import moment from 'moment';
import Overlay from '../overlay';
import Input from '../input';
import Calendar from '../calendar';
import TimePickerPanel from '../time-picker/panel';
import nextLocale from '../locale/zh-cn';
import { func, obj } from '../util';
import { PANEL, resetValueTime, checkDateValue, formatDateValue, getDateTimeFormat, extend, onDateKeydown, onTimeKeydown } from './util';
import PanelFooter from './module/panel-footer';
var Popup = Overlay.Popup;
/**
 * DatePicker
 */

var DatePicker =
/*#__PURE__*/
function (_Component) {
  _inherits(DatePicker, _Component);

  function DatePicker(props, context) {
    var _this;

    _classCallCheck(this, DatePicker);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(DatePicker).call(this, props, context));

    _defineProperty(_assertThisInitialized(_this), "getOverlay", function () {
      return _this.popup && _this.popup.getInstance() && _this.popup.getInstance().getOverlay();
    });

    _defineProperty(_assertThisInitialized(_this), "onModeChange", function (mode) {
      _this.setState({
        mode: mode
      });
    });

    _defineProperty(_assertThisInitialized(_this), "onValueChange", function (newValue) {
      var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'onChange';
      var ret = _this.inputAsString && newValue ? newValue.format(_this.dateTimeFormat) : newValue;

      _this.props[handler](ret);
    });

    _defineProperty(_assertThisInitialized(_this), "onSelectCalendarPanel", function (value) {
      var _this$props = _this.props,
          showTime = _this$props.showTime,
          resetTime = _this$props.resetTime;
      var prevValue = _this.state.value;
      var newValue = value;

      if (showTime) {
        if (!prevValue) {
          // 第一次选择日期值时，如果设置了默认时间，则使用该默认时间
          if (showTime.defaultValue) {
            var defaultTimeValue = formatDateValue(showTime.defaultValue, _this.timeFormat);
            newValue = resetValueTime(value, defaultTimeValue);
          }
        } else if (!resetTime) {
          // 非第一选择日期，如果开启了 resetTime 属性，则记住之前选择的时间值
          newValue = resetValueTime(value, prevValue);
        }
      }

      _this.handleChange(newValue, prevValue, {
        inputing: false
      });

      if (!showTime) {
        _this.onVisibleChange(false, 'calendarSelect');
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onSelectTimePanel", function (value) {
      _this.handleChange(value, _this.state.value, {
        inputing: false
      });
    });

    _defineProperty(_assertThisInitialized(_this), "clearValue", function () {
      _this.setState({
        dateInputStr: '',
        timeInputStr: ''
      });

      _this.handleChange(null, _this.state.value, {
        inputing: false
      });
    });

    _defineProperty(_assertThisInitialized(_this), "onDateInputChange", function (inputStr, e, eventType) {
      if (eventType === 'clear' || !inputStr) {
        e.stopPropagation();

        _this.clearValue();
      } else {
        _this.setState({
          dateInputStr: inputStr,
          inputing: 'date'
        });
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onTimeInputChange", function (inputStr) {
      _this.setState({
        timeInputStr: inputStr,
        inputing: 'time'
      });
    });

    _defineProperty(_assertThisInitialized(_this), "onDateInputBlur", function () {
      var dateInputStr = _this.state.dateInputStr;

      if (dateInputStr) {
        var disabledDate = _this.props.disabledDate;
        var parsed = moment(dateInputStr, _this.format, true);

        _this.setState({
          dateInputStr: '',
          inputing: false
        });

        if (parsed.isValid() && !disabledDate(parsed, 'date')) {
          _this.handleChange(parsed, _this.state.value);
        }
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onTimeInputBlur", function () {
      var _this$state = _this.state,
          value = _this$state.value,
          timeInputStr = _this$state.timeInputStr;

      if (timeInputStr) {
        var parsed = moment(timeInputStr, _this.timeFormat, true);

        _this.setState({
          timeInputStr: '',
          inputing: false
        });

        if (parsed.isValid()) {
          var hour = parsed.hour();
          var minute = parsed.minute();
          var second = parsed.second();
          var newValue = value.clone().hour(hour).minute(minute).second(second);

          _this.handleChange(newValue, _this.state.value);
        }
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (e) {
      var format = _this.props.format;
      var _this$state2 = _this.state,
          dateInputStr = _this$state2.dateInputStr,
          value = _this$state2.value;
      var dateStr = onDateKeydown(e, {
        format: format,
        dateInputStr: dateInputStr,
        value: value
      }, 'day');
      if (!dateStr) return;

      _this.onDateInputChange(dateStr);
    });

    _defineProperty(_assertThisInitialized(_this), "onTimeKeyDown", function (e) {
      var showTime = _this.props.showTime;
      var _this$state3 = _this.state,
          timeInputStr = _this$state3.timeInputStr,
          value = _this$state3.value;

      var _ref = _typeof(showTime) === 'object' ? showTime : {},
          disabledMinutes = _ref.disabledMinutes,
          disabledSeconds = _ref.disabledSeconds,
          _ref$hourStep = _ref.hourStep,
          hourStep = _ref$hourStep === void 0 ? 1 : _ref$hourStep,
          _ref$minuteStep = _ref.minuteStep,
          minuteStep = _ref$minuteStep === void 0 ? 1 : _ref$minuteStep,
          _ref$secondStep = _ref.secondStep,
          secondStep = _ref$secondStep === void 0 ? 1 : _ref$secondStep;

      var unit = 'second';

      if (disabledSeconds) {
        unit = disabledMinutes ? 'hour' : 'minute';
      }

      var timeStr = onTimeKeydown(e, {
        format: _this.timeFormat,
        timeInputStr: timeInputStr,
        value: value,
        steps: {
          hour: hourStep,
          minute: minuteStep,
          second: secondStep
        }
      }, unit);
      if (!timeStr) return;

      _this.onTimeInputChange(timeStr);
    });

    _defineProperty(_assertThisInitialized(_this), "handleChange", function (newValue, prevValue) {
      var others = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

      if (!('value' in _this.props)) {
        _this.setState(_objectSpread({
          value: newValue
        }, others));
      } else {
        _this.setState(_objectSpread({}, others));
      }

      var newValueOf = newValue ? newValue.valueOf() : null;
      var preValueOf = prevValue ? prevValue.valueOf() : null;

      if (newValueOf !== preValueOf) {
        _this.onValueChange(newValue);
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onFocusDateInput", function () {
      if (_this.state.panel !== PANEL.DATE) {
        _this.setState({
          panel: PANEL.DATE
        });
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onFoucsTimeInput", function () {
      if (_this.state.panel !== PANEL.TIME) {
        _this.setState({
          panel: PANEL.TIME
        });
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onVisibleChange", function (visible, type) {
      if (!('visible' in _this.props)) {
        _this.setState({
          visible: visible
        });
      }

      _this.props.onVisibleChange(visible, type);
    });

    _defineProperty(_assertThisInitialized(_this), "changePanel", function (panel) {
      _this.setState({
        panel: panel
      });
    });

    _defineProperty(_assertThisInitialized(_this), "onOk", function () {
      _this.onVisibleChange(false, 'okBtnClick');

      _this.onValueChange(_this.state.value, 'onOk');
    });

    var dateTimeFormat = getDateTimeFormat(props.format, props.showTime);
    extend(dateTimeFormat, _assertThisInitialized(_this));

    var _value = formatDateValue(props.value || props.defaultValue, _this.dateTimeFormat);

    _this.inputAsString = typeof (props.value || props.defaultValue) === 'string'; // 判断用户输入是否是字符串

    _this.state = {
      mode: 'date',
      value: _value,
      dateInputStr: '',
      timeInputStr: '',
      inputing: false,
      // 当前是否处于输入状态
      visible: props.visible || props.defaultVisible,
      panel: PANEL.DATE
    };
    _this.popup = null;
    return _this;
  }

  _createClass(DatePicker, [{
    key: "UNSAFE_componentWillReceiveProps",
    value: function UNSAFE_componentWillReceiveProps(nextProps) {
      if ('showTime' in nextProps) {
        var dateTimeFormat = getDateTimeFormat(nextProps.format || this.props.format, nextProps.showTime);
        extend(dateTimeFormat, this);
      }

      if ('value' in nextProps) {
        var value = formatDateValue(nextProps.value, this.dateTimeFormat);
        this.setState({
          value: value
        });
        this.inputAsString = typeof nextProps.value === 'string';
      }

      if ('visible' in nextProps) {
        this.setState({
          visible: nextProps.visible
        });
      }
    } // 获取底层的overlay实例

  }, {
    key: "render",
    value: function render() {
      var _classnames2,
          _classnames3,
          _classnames4,
          _PANEL$DATE$PANEL$TIM,
          _this2 = this;

      var _this$props2 = this.props,
          prefix = _this$props2.prefix,
          rtl = _this$props2.rtl,
          locale = _this$props2.locale,
          label = _this$props2.label,
          state = _this$props2.state,
          defaultVisibleMonth = _this$props2.defaultVisibleMonth,
          onVisibleMonthChange = _this$props2.onVisibleMonthChange,
          showTime = _this$props2.showTime,
          disabledDate = _this$props2.disabledDate,
          footerRender = _this$props2.footerRender,
          placeholder = _this$props2.placeholder,
          size = _this$props2.size,
          disabled = _this$props2.disabled,
          hasClear = _this$props2.hasClear,
          popupTriggerType = _this$props2.popupTriggerType,
          popupAlign = _this$props2.popupAlign,
          popupContainer = _this$props2.popupContainer,
          popupStyle = _this$props2.popupStyle,
          popupClassName = _this$props2.popupClassName,
          popupProps = _this$props2.popupProps,
          followTrigger = _this$props2.followTrigger,
          className = _this$props2.className,
          inputProps = _this$props2.inputProps,
          triggerRender = _this$props2.triggerRender,
          dateCellRender = _this$props2.dateCellRender,
          monthCellRender = _this$props2.monthCellRender,
          yearCellRender = _this$props2.yearCellRender,
          dateInputAriaLabel = _this$props2.dateInputAriaLabel,
          timeInputAriaLabel = _this$props2.timeInputAriaLabel,
          inline = _this$props2.inline,
          others = _objectWithoutProperties(_this$props2, ["prefix", "rtl", "locale", "label", "state", "defaultVisibleMonth", "onVisibleMonthChange", "showTime", "disabledDate", "footerRender", "placeholder", "size", "disabled", "hasClear", "popupTriggerType", "popupAlign", "popupContainer", "popupStyle", "popupClassName", "popupProps", "followTrigger", "className", "inputProps", "triggerRender", "dateCellRender", "monthCellRender", "yearCellRender", "dateInputAriaLabel", "timeInputAriaLabel", "inline"]);

      var _this$state4 = this.state,
          mode = _this$state4.mode,
          visible = _this$state4.visible,
          value = _this$state4.value,
          dateInputStr = _this$state4.dateInputStr,
          timeInputStr = _this$state4.timeInputStr,
          panel = _this$state4.panel,
          inputing = _this$state4.inputing;
      var datePickerCls = classnames(_defineProperty({}, "".concat(prefix, "date-picker"), true), className);
      var triggerInputCls = classnames((_classnames2 = {}, _defineProperty(_classnames2, "".concat(prefix, "date-picker-input"), true), _defineProperty(_classnames2, "".concat(prefix, "error"), false), _classnames2));
      var panelBodyClassName = classnames((_classnames3 = {}, _defineProperty(_classnames3, "".concat(prefix).concat(mode, "-picker-body"), true), _defineProperty(_classnames3, "".concat(prefix, "date-picker-body-show-time"), showTime), _defineProperty(_classnames3, "".concat(prefix).concat(mode, "-picker-inline"), inline), _defineProperty(_classnames3, "".concat(prefix).concat(mode, "-picker-disabled"), disabled), _classnames3));
      var panelDateInputCls = classnames((_classnames4 = {}, _defineProperty(_classnames4, "".concat(prefix, "date-picker-panel-input"), true), _defineProperty(_classnames4, "".concat(prefix, "focus"), panel === PANEL.DATE), _classnames4));

      if (rtl) {
        others.dir = 'rtl';
      }

      var sharedInputProps = _objectSpread({}, inputProps, {
        size: size,
        disabled: disabled,
        onChange: this.onDateInputChange,
        onBlur: this.onDateInputBlur,
        onPressEnter: this.onDateInputBlur,
        onKeyDown: this.onKeyDown
      });

      var dateInputValue = inputing === 'date' ? dateInputStr : value && value.format(this.format) || '';
      var triggerInputValue = dateInputValue;
      var dateInput = React.createElement(Input, _extends({}, sharedInputProps, {
        hasClear: true,
        size: "xs",
        "aria-label": dateInputAriaLabel,
        value: dateInputValue,
        onFocus: this.onFocusDateInput,
        placeholder: this.format,
        className: panelDateInputCls
      }));
      var datePanel = React.createElement(Calendar, {
        shape: "panel",
        mode: mode,
        value: value,
        format: this.format,
        dateCellRender: dateCellRender,
        monthCellRender: monthCellRender,
        yearCellRender: yearCellRender,
        onModeChange: this.onModeChange,
        onSelect: this.onSelectCalendarPanel,
        defaultVisibleMonth: defaultVisibleMonth,
        onVisibleMonthChange: onVisibleMonthChange,
        disabledDate: disabledDate
      });
      var panelFooter = footerRender();
      var timeInput = null;
      var timePanel = null;

      if (showTime) {
        var _classnames5;

        var timeInputValue = inputing === 'time' ? timeInputStr : value && value.format(this.timeFormat) || '';
        triggerInputValue = value && value.format(this.dateTimeFormat) || '';
        var timePanelProps = _typeof(showTime) === 'object' ? showTime : {};
        var showSecond = this.timeFormat.indexOf('s') > -1;
        var panelTimeInputCls = classnames((_classnames5 = {}, _defineProperty(_classnames5, "".concat(prefix, "date-picker-panel-input"), true), _defineProperty(_classnames5, "".concat(prefix, "focus"), panel === PANEL.TIME), _classnames5));
        timeInput = React.createElement(Input, {
          placeholder: this.timeFormat,
          value: timeInputValue,
          size: "xs",
          "aria-label": timeInputAriaLabel,
          disabled: disabled || !value,
          onChange: this.onTimeInputChange,
          onFocus: this.onFoucsTimeInput,
          onBlur: this.onTimeInputBlur,
          onPressEnter: this.onTimeInputBlur,
          onKeyDown: this.onTimeKeyDown,
          className: panelTimeInputCls
        });
        timePanel = React.createElement(TimePickerPanel, _extends({}, timePanelProps, {
          locale: locale,
          className: "".concat(prefix, "date-picker-panel-time"),
          showSecond: showSecond,
          disabled: disabled,
          prefix: prefix,
          value: value,
          onSelect: this.onSelectTimePanel
        }));
        panelFooter = panelFooter || React.createElement(PanelFooter, {
          prefix: prefix,
          locale: locale,
          value: value,
          panel: panel,
          onPanelChange: this.changePanel,
          onOk: this.onOk
        });
      }

      var panelBody = (_PANEL$DATE$PANEL$TIM = {}, _defineProperty(_PANEL$DATE$PANEL$TIM, PANEL.DATE, datePanel), _defineProperty(_PANEL$DATE$PANEL$TIM, PANEL.TIME, timePanel), _PANEL$DATE$PANEL$TIM)[panel];
      var allowClear = value && hasClear;
      var trigger = triggerRender ? triggerRender(value, {
        popupVisible: visible
      }) : React.createElement("div", {
        className: "".concat(prefix, "date-picker-trigger")
      }, React.createElement(Input, _extends({}, sharedInputProps, {
        label: label,
        state: state,
        value: triggerInputValue,
        role: "combobox",
        "aria-expanded": visible,
        readOnly: true,
        placeholder: placeholder || (showTime ? locale.datetimePlaceholder : locale.placeholder),
        hint: "calendar",
        hasClear: allowClear,
        className: triggerInputCls
      })));
      var body = React.createElement("div", {
        dir: others.dir,
        className: panelBodyClassName
      }, React.createElement("div", {
        className: "".concat(prefix, "date-picker-panel-header")
      }, dateInput, timeInput), panelBody, panelFooter);
      var content = inline ? body : React.createElement(Popup, _extends({
        offset: [0, 4]
      }, popupProps, {
        ref: function ref(popup) {
          _this2.popup = popup;
        },
        followTrigger: followTrigger,
        autoFocus: true,
        disabled: disabled,
        visible: visible,
        onVisibleChange: this.onVisibleChange,
        align: popupAlign,
        triggerType: popupTriggerType,
        container: popupContainer,
        style: popupStyle,
        className: popupClassName,
        trigger: trigger
      }), body);
      return React.createElement("div", _extends({}, obj.pickOthers(DatePicker.propTypes, others), {
        className: datePickerCls
      }), content);
    }
  }]);

  return DatePicker;
}(Component);

_defineProperty(DatePicker, "displayName", 'DatePicker');

_defineProperty(DatePicker, "propTypes", {
  prefix: PropTypes.string,
  rtl: PropTypes.bool,

  /**
   * 输入框内置标签
   */
  label: PropTypes.node,

  /**
   * 输入框状态
   */
  state: PropTypes.oneOf(['success', 'loading', 'error']),

  /**
   * 输入提示
   */
  placeholder: PropTypes.string,

  /**
   * 默认展现的月
   * @return {MomentObject} 返回包含指定月份的 moment 对象实例
   */
  defaultVisibleMonth: PropTypes.func,
  onVisibleMonthChange: PropTypes.func,

  /**
   * 日期值（受控）moment 对象
   */
  value: checkDateValue,

  /**
   * 初始日期值，moment 对象
   */
  defaultValue: checkDateValue,

  /**
   * 日期值的格式（用于限定用户输入和展示）
   */
  format: PropTypes.string,

  /**
   * 是否使用时间控件，传入 TimePicker 的属性 { defaultValue, format, ... }
   */
  showTime: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),

  /**
   * 每次选择日期时是否重置时间（仅在 showTime 开启时有效）
   */
  resetTime: PropTypes.bool,

  /**
   * 禁用日期函数
   * @param {MomentObject} 日期值
   * @param {String} view 当前视图类型，year: 年， month: 月, date: 日
   * @return {Boolean} 是否禁用
   */
  disabledDate: PropTypes.func,

  /**
   * 自定义面板页脚
   * @return {Node} 自定义的面板页脚组件
   */
  footerRender: PropTypes.func,

  /**
   * 日期值改变时的回调
   * @param {MomentObject|String} value 日期值
   */
  onChange: PropTypes.func,

  /**
   * 点击确认按钮时的回调
   * @return {MomentObject|String} 日期值
   */
  onOk: PropTypes.func,

  /**
   * 输入框尺寸
   */
  size: PropTypes.oneOf(['small', 'medium']),

  /**
   * 是否禁用
   */
  disabled: PropTypes.bool,

  /**
   * 是否显示清空按钮
   */
  hasClear: PropTypes.bool,

  /**
   * 弹层显示状态
   */
  visible: PropTypes.bool,

  /**
   * 弹层默认是否显示
   */
  defaultVisible: PropTypes.bool,

  /**
   * 弹层展示状态变化时的回调
   * @param {Boolean} visible 弹层是否显示
   * @param {String} type 触发弹层显示和隐藏的来源 calendarSelect 表示由日期表盘的选择触发； okBtnClick 表示由确认按钮触发； fromTrigger 表示由trigger的点击触发； docClick 表示由document的点击触发
   */
  onVisibleChange: PropTypes.func,

  /**
   * 弹层触发方式
   */
  popupTriggerType: PropTypes.oneOf(['click', 'hover']),

  /**
   * 弹层对齐方式,具体含义见 OverLay文档
   */
  popupAlign: PropTypes.string,

  /**
   * 弹层容器
   * @param {Element} target 目标元素
   * @return {Element} 弹层的容器元素
   */
  popupContainer: PropTypes.func,

  /**
   * 弹层自定义样式
   */
  popupStyle: PropTypes.object,

  /**
   * 弹层自定义样式类
   */
  popupClassName: PropTypes.string,

  /**
   * 弹层其他属性
   */
  popupProps: PropTypes.object,

  /**
   * 是否跟随滚动
   */
  followTrigger: PropTypes.bool,

  /**
   * 输入框其他属性
   */
  inputProps: PropTypes.object,

  /**
   * 是否开启行内模式
   */
  inline: PropTypes.bool,

  /**
   * 自定义触发器
   * @param {Object} value 日期值（moment对象)
   * @param {Object} state 附加状态
   * @returns {ReactNode}
   */
  triggerRender: PropTypes.func,

  /**
   * 自定义日期渲染函数
   * @param {Object} value 日期值（moment对象）
   * @returns {ReactNode}
   */
  dateCellRender: PropTypes.func,

  /**
   * 自定义月份渲染函数
   * @param {Object} calendarDate 对应 Calendar 返回的自定义日期对象
   * @returns {ReactNode}
   */
  monthCellRender: PropTypes.func,
  yearCellRender: PropTypes.func,
  // 兼容 0.x yearCellRender

  /**
   * 日期输入框的 aria-label 属性
   */
  dateInputAriaLabel: PropTypes.string,

  /**
   * 时间输入框的 aria-label 属性
   */
  timeInputAriaLabel: PropTypes.string,
  locale: PropTypes.object,
  className: PropTypes.string
});

_defineProperty(DatePicker, "defaultProps", {
  prefix: 'next-',
  rtl: false,
  format: 'YYYY/MM/DD',
  size: 'medium',
  showTime: false,
  resetTime: false,
  disabledDate: function disabledDate() {
    return false;
  },
  footerRender: function footerRender() {
    return null;
  },
  hasClear: true,
  popupTriggerType: 'click',
  popupAlign: 'tl bl',
  locale: nextLocale.DatePicker,
  defaultVisible: false,
  onChange: func.noop,
  onVisibleChange: func.noop,
  onOk: func.noop
});

export { DatePicker as default };