"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _antd = require("antd");
require("moment/locale/zh-cn");
var _zh_CN = _interopRequireDefault(require("antd/lib/calendar/locale/zh_CN.js"));
var _calendar_icon_ld = _interopRequireDefault(require("../../imgs/calendar_icon_ld.png"));
var _calendar_icon_yl = _interopRequireDefault(require("../../imgs/calendar_icon_yl.png"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var MyCalendar = function MyCalendar(_ref) {
  var data = _ref.data,
    month = _ref.month;
  var getListData = function getListData(value) {
    var listData;
    if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
      var obj = data.find(function (ele) {
        return ele.date === value.format('YYYY-MM-DD');
      });
      return obj || {};
    }
    return listData || {};
  };
  var dateCellRender = function dateCellRender(value) {
    var _a, _b;
    var listData = getListData(value);
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "my-calendar-cell",
      style: {
        background: 'transparent'
      },
      onClick: function onClick() {}
    }, listData.count && (/*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
      className: "my-calendar-item",
      style: {
        marginBottom: 8
      }
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: _calendar_icon_ld["default"]
    }), /*#__PURE__*/_react["default"].createElement("div", null, (_a = listData.count) !== null && _a !== void 0 ? _a : 0, "\u6B21")), /*#__PURE__*/_react["default"].createElement("div", {
      className: "my-calendar-item"
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: _calendar_icon_yl["default"]
    }), /*#__PURE__*/_react["default"].createElement("div", null, (_b = listData.weight) !== null && _b !== void 0 ? _b : 0, "\u5428")))));
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "my-calendar"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "my-calendar-legend"
  }, /*#__PURE__*/_react["default"].createElement("span", {
    style: {
      display: 'flex',
      alignItems: 'center',
      gap: 8
    }
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: _calendar_icon_ld["default"]
  }), /*#__PURE__*/_react["default"].createElement("span", null, "\u8054\u5355\u6570")), /*#__PURE__*/_react["default"].createElement("span", {
    style: {
      display: 'flex',
      alignItems: 'center',
      gap: 8
    }
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: _calendar_icon_yl["default"]
  }), /*#__PURE__*/_react["default"].createElement("span", null, "\u603B\u8FD0\u91CF"))), /*#__PURE__*/_react["default"].createElement(_antd.Calendar, {
    headerRender: function headerRender() {
      return null;
    },
    dateCellRender: dateCellRender,
    locale: _zh_CN["default"],
    value: month
  }));
};
var _default = exports["default"] = MyCalendar;
//# sourceMappingURL=MyCalendar.js.map
