"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

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

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

var _lottieWeb = _interopRequireDefault(require("lottie-web"));

var _okrcaseCard = _interopRequireDefault(require("./okrcase-card"));

var _data = _interopRequireDefault(require("../../image/data.json"));

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

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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 OkrCaseCardLsit(props) {
  var cardList = props.cardList,
      isUnlock = props.isUnlock,
      handleShowPayWindow = props.handleShowPayWindow,
      handleShowSubmitOkrWindow = props.handleShowSubmitOkrWindow,
      _onApplyTpl = props.onApplyTpl,
      isLoading = props.isLoading;
  (0, _react.useEffect)(function () {
    _lottieWeb["default"].loadAnimation({
      // @ts-ignore
      container: document.getElementById("lottie-loading"),
      renderer: "svg",
      loop: true,
      autoplay: true,
      animationData: _data["default"]
    });
  }, [isLoading]);
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-cases-library__cardList"
  }, cardList.length ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, cardList.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_okrcaseCard["default"], {
      key: item.id,
      cardInfo: item,
      index: index + 1,
      onApplyTpl: function onApplyTpl() {
        return _onApplyTpl(item);
      }
    });
  }), new Array(20).fill("1").map(function () {
    return /*#__PURE__*/_react["default"].createElement("div", {
      style: {
        height: "0",
        width: "46%",
        flexGrow: 1
      }
    });
  }), isLoading && /*#__PURE__*/_react["default"].createElement("div", {
    id: "lottie-loading",
    className: "okr-cases-library__cardList-loading"
  }), !isUnlock && /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-cases-library__cardList__formember",
    onClick: function onClick() {
      return handleShowPayWindow(true);
    }
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: require("../../image/\u4F1A\u5458.svg")
  }), " ", "\u5F00\u901A\u4F1A\u5458\u67E5\u770B\u66F4\u591A\u6848\u4F8B\u5E93")) : /*#__PURE__*/_react["default"].createElement("div", {
    className: "okr-cases-library__cardList-empty"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: require("../../image/\u725B\u725B.png")
  }), /*#__PURE__*/_react["default"].createElement("p", null, "\u6682\u65E0\u4F60\u60F3\u8981\u7684 OKR \u6848\u4F8B\uFF0C", /*#__PURE__*/_react["default"].createElement("a", {
    onClick: function onClick() {
      return handleShowSubmitOkrWindow(true);
    }
  }, "\u63D0\u4EA4\u4F60\u60F3\u8981\u7684 OKR \u7C7B\u578B"))));
}

var _default = OkrCaseCardLsit;
exports["default"] = _default;