"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

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

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));

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

var _DateConstants = _interopRequireDefault(require("./DateConstants"));

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

var DateTHead = /*#__PURE__*/function (_Component) {
  (0, _inherits2["default"])(DateTHead, _Component);

  var _super = (0, _createSuper2["default"])(DateTHead);

  function DateTHead() {
    (0, _classCallCheck2["default"])(this, DateTHead);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(DateTHead, [{
    key: "render",
    value: function render() {
      var props = this.props;
      var value = props.value;
      var localeData = value.localeData();
      var prefixCls = props.prefixCls;
      var veryShortWeekdays = [];
      var weekDays = [];
      var firstDayOfWeek = localeData.firstDayOfWeek();
      var showWeekNumberEl;
      var now = (0, _moment["default"])();

      for (var dateColIndex = 0; dateColIndex < _DateConstants["default"].DATE_COL_COUNT; dateColIndex++) {
        var index = (firstDayOfWeek + dateColIndex) % _DateConstants["default"].DATE_COL_COUNT;
        now.day(index);
        veryShortWeekdays[dateColIndex] = localeData.weekdaysMin(now);
        weekDays[dateColIndex] = localeData.weekdaysShort(now);
      }

      if (props.showWeekNumber) {
        showWeekNumberEl = /*#__PURE__*/_react["default"].createElement("th", {
          role: "columnheader",
          className: "".concat(prefixCls, "-column-header ").concat(prefixCls, "-week-number-header")
        }, /*#__PURE__*/_react["default"].createElement("span", {
          className: "".concat(prefixCls, "-column-header-inner")
        }, "x"));
      }

      var weekDaysEls = weekDays.map(function (day, xindex) {
        return /*#__PURE__*/_react["default"].createElement("th", {
          key: xindex,
          role: "columnheader",
          title: day,
          className: "".concat(prefixCls, "-column-header")
        }, /*#__PURE__*/_react["default"].createElement("span", {
          className: "".concat(prefixCls, "-column-header-inner")
        }, veryShortWeekdays[xindex]));
      });
      return /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", {
        role: "row"
      }, showWeekNumberEl, weekDaysEls));
    }
  }]);
  return DateTHead;
}(_react.Component);

exports["default"] = DateTHead;
//# sourceMappingURL=DateTHead.js.map
