"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _classnames6 = _interopRequireDefault(require("classnames"));

var _moment = _interopRequireDefault(require("moment"));

var _overlay = _interopRequireDefault(require("../overlay"));

var _input = _interopRequireDefault(require("../input"));

var _calendar = _interopRequireDefault(require("../calendar"));

var _panel = _interopRequireDefault(require("../time-picker/panel"));

var _zhCn = _interopRequireDefault(require("../locale/zh-cn"));

var _util = require("../util");

var _util2 = require("./util");

var _panelFooter = _interopRequireDefault(require("./module/panel-footer"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

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; }

var Popup = _overlay["default"].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 = (0, _util2.formatDateValue)(showTime.defaultValue, _this.timeFormat);
            newValue = (0, _util2.resetValueTime)(value, defaultTimeValue);
          }
        } else if (!resetTime) {
          // 非第一选择日期，如果开启了 resetTime 属性，则记住之前选择的时间值
          newValue = (0, _util2.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 = (0, _moment["default"])(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 = (0, _moment["default"])(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 = (0, _util2.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 = (0, _util2.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 !== _util2.PANEL.DATE) {
        _this.setState({
          panel: _util2.PANEL.DATE
        });
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onFoucsTimeInput", function () {
      if (_this.state.panel !== _util2.PANEL.TIME) {
        _this.setState({
          panel: _util2.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 = (0, _util2.getDateTimeFormat)(props.format, props.showTime);
    (0, _util2.extend)(dateTimeFormat, _assertThisInitialized(_this));

    var _value = (0, _util2.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: _util2.PANEL.DATE
    };
    _this.popup = null;
    return _this;
  }

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

      if ('value' in nextProps) {
        var value = (0, _util2.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 = (0, _classnames6["default"])(_defineProperty({}, "".concat(prefix, "date-picker"), true), className);
      var triggerInputCls = (0, _classnames6["default"])((_classnames2 = {}, _defineProperty(_classnames2, "".concat(prefix, "date-picker-input"), true), _defineProperty(_classnames2, "".concat(prefix, "error"), false), _classnames2));
      var panelBodyClassName = (0, _classnames6["default"])((_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 = (0, _classnames6["default"])((_classnames4 = {}, _defineProperty(_classnames4, "".concat(prefix, "date-picker-panel-input"), true), _defineProperty(_classnames4, "".concat(prefix, "focus"), panel === _util2.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["default"].createElement(_input["default"], _extends({}, sharedInputProps, {
        hasClear: true,
        size: "xs",
        "aria-label": dateInputAriaLabel,
        value: dateInputValue,
        onFocus: this.onFocusDateInput,
        placeholder: this.format,
        className: panelDateInputCls
      }));

      var datePanel = _react["default"].createElement(_calendar["default"], {
        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 = (0, _classnames6["default"])((_classnames5 = {}, _defineProperty(_classnames5, "".concat(prefix, "date-picker-panel-input"), true), _defineProperty(_classnames5, "".concat(prefix, "focus"), panel === _util2.PANEL.TIME), _classnames5));
        timeInput = _react["default"].createElement(_input["default"], {
          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["default"].createElement(_panel["default"], _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["default"].createElement(_panelFooter["default"], {
          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, _util2.PANEL.DATE, datePanel), _defineProperty(_PANEL$DATE$PANEL$TIM, _util2.PANEL.TIME, timePanel), _PANEL$DATE$PANEL$TIM)[panel];
      var allowClear = value && hasClear;
      var trigger = triggerRender ? triggerRender(value, {
        popupVisible: visible
      }) : _react["default"].createElement("div", {
        className: "".concat(prefix, "date-picker-trigger")
      }, _react["default"].createElement(_input["default"], _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["default"].createElement("div", {
        dir: others.dir,
        className: panelBodyClassName
      }, _react["default"].createElement("div", {
        className: "".concat(prefix, "date-picker-panel-header")
      }, dateInput, timeInput), panelBody, panelFooter);

      var content = inline ? body : _react["default"].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["default"].createElement("div", _extends({}, _util.obj.pickOthers(DatePicker.propTypes, others), {
        className: datePickerCls
      }), content);
    }
  }]);

  return DatePicker;
}(_react.Component);

exports["default"] = DatePicker;

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

_defineProperty(DatePicker, "propTypes", {
  prefix: _propTypes["default"].string,
  rtl: _propTypes["default"].bool,

  /**
   * 输入框内置标签
   */
  label: _propTypes["default"].node,

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

  /**
   * 输入提示
   */
  placeholder: _propTypes["default"].string,

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

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

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

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

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

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

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

  /**
   * 自定义面板页脚
   * @return {Node} 自定义的面板页脚组件
   */
  footerRender: _propTypes["default"].func,

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

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

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

  /**
   * 是否禁用
   */
  disabled: _propTypes["default"].bool,

  /**
   * 是否显示清空按钮
   */
  hasClear: _propTypes["default"].bool,

  /**
   * 弹层显示状态
   */
  visible: _propTypes["default"].bool,

  /**
   * 弹层默认是否显示
   */
  defaultVisible: _propTypes["default"].bool,

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

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

  /**
   * 弹层对齐方式,具体含义见 OverLay文档
   */
  popupAlign: _propTypes["default"].string,

  /**
   * 弹层容器
   * @param {Element} target 目标元素
   * @return {Element} 弹层的容器元素
   */
  popupContainer: _propTypes["default"].func,

  /**
   * 弹层自定义样式
   */
  popupStyle: _propTypes["default"].object,

  /**
   * 弹层自定义样式类
   */
  popupClassName: _propTypes["default"].string,

  /**
   * 弹层其他属性
   */
  popupProps: _propTypes["default"].object,

  /**
   * 是否跟随滚动
   */
  followTrigger: _propTypes["default"].bool,

  /**
   * 输入框其他属性
   */
  inputProps: _propTypes["default"].object,

  /**
   * 是否开启行内模式
   */
  inline: _propTypes["default"].bool,

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

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

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

  /**
   * 日期输入框的 aria-label 属性
   */
  dateInputAriaLabel: _propTypes["default"].string,

  /**
   * 时间输入框的 aria-label 属性
   */
  timeInputAriaLabel: _propTypes["default"].string,
  locale: _propTypes["default"].object,
  className: _propTypes["default"].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: _zhCn["default"].DatePicker,
  defaultVisible: false,
  onChange: _util.func.noop,
  onVisibleChange: _util.func.noop,
  onOk: _util.func.noop
});