import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import toFragment from '../../util/Children/mapSelf';
import cx from 'classnames';
import TodayButton from '../calendar/TodayButton';
import OkButton from '../calendar/OkButton';
import TimePickerButton from '../calendar/TimePickerButton';
var CalendarFooter = createReactClass({
  displayName: "CalendarFooter",
  onSelect: function onSelect(value) {
    this.props.onSelect(value);
  },
  getRootDOMNode: function getRootDOMNode() {
    return ReactDOM.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.createElement(TodayButton, _extends({}, props, {
          value: value
        }));
      }

      var okBtn;

      if (showOk === true || showOk !== false && !!props.timePicker) {
        okBtn = /*#__PURE__*/React.createElement(OkButton, props);
      }

      var timePickerBtn;

      if (!!props.timePicker) {
        timePickerBtn = /*#__PURE__*/React.createElement(TimePickerButton, props);
      }

      var footerBtn;

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

      var cls = cx((_cx = {}, _defineProperty(_cx, "".concat(prefixCls, "-footer"), true), _defineProperty(_cx, "".concat(prefixCls, "-footer-show-ok"), okBtn), _cx));
      footerEl = /*#__PURE__*/React.createElement("div", {
        className: cls
      }, extraFooter, footerBtn);
    }

    return footerEl;
  }
});
export default CalendarFooter;
//# sourceMappingURL=CalendarFooter.js.map
