"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

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

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

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

var _reactDom = _interopRequireDefault(require("react-dom"));

var _createReactClass = _interopRequireDefault(require("create-react-class"));

var _mapSelf = _interopRequireDefault(require("../../util/Children/mapSelf"));

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

var _TodayButton = _interopRequireDefault(require("../calendar/TodayButton"));

var _OkButton = _interopRequireDefault(require("../calendar/OkButton"));

var _TimePickerButton = _interopRequireDefault(require("../calendar/TimePickerButton"));

var CalendarFooter = (0, _createReactClass["default"])({
  displayName: "CalendarFooter",
  onSelect: function onSelect(value) {
    this.props.onSelect(value);
  },
  getRootDOMNode: function getRootDOMNode() {
    return _reactDom["default"].findDOMNode(this);
  },
  render: function render() {
    var props = this.props;
    var value = props.value,
        prefixCls = props.prefixCls,
        showOk = props.showOk,
        timePicker = props.timePicker,
        renderFooter = props.renderFooter;
    var footerEl = null;
    var extraFooter = renderFooter();

    if (props.showToday || timePicker || extraFooter) {
      var _cx;

      var nowEl;

      if (props.showToday) {
        nowEl = /*#__PURE__*/_react["default"].createElement(_TodayButton["default"], (0, _extends2["default"])({}, props, {
          value: value
        }));
      }

      var okBtn;

      if (showOk === true || showOk !== false && !!props.timePicker) {
        okBtn = /*#__PURE__*/_react["default"].createElement(_OkButton["default"], props);
      }

      var timePickerBtn;

      if (!!props.timePicker) {
        timePickerBtn = /*#__PURE__*/_react["default"].createElement(_TimePickerButton["default"], props);
      }

      var footerBtn;

      if (nowEl || timePickerBtn || okBtn) {
        footerBtn = /*#__PURE__*/_react["default"].createElement("span", {
          className: "".concat(prefixCls, "-footer-btn")
        }, (0, _mapSelf["default"])([nowEl, timePickerBtn, okBtn]));
      }

      var cls = (0, _classnames["default"])((_cx = {}, (0, _defineProperty2["default"])(_cx, "".concat(prefixCls, "-footer"), true), (0, _defineProperty2["default"])(_cx, "".concat(prefixCls, "-footer-show-ok"), okBtn), _cx));
      footerEl = /*#__PURE__*/_react["default"].createElement("div", {
        className: cls
      }, extraFooter, footerBtn);
    }

    return footerEl;
  }
});
var _default = CalendarFooter;
exports["default"] = _default;
//# sourceMappingURL=CalendarFooter.js.map
