"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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

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

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 _classnames = _interopRequireDefault(require("classnames"));

var _reactLazyLoad = _interopRequireDefault(require("react-lazy-load"));

var _checkbox = _interopRequireDefault(require("../checkbox"));

var _PureRenderMixin = _interopRequireDefault(require("../rc-components/util/PureRenderMixin"));

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

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

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

  (0, _createClass2["default"])(Item, [{
    key: "shouldComponentUpdate",
    value: function shouldComponentUpdate() {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }

      return _PureRenderMixin["default"].shouldComponentUpdate.apply(this, args);
    }
  }, {
    key: "render",
    value: function render() {
      var _classNames;

      var _this$props = this.props,
          renderedText = _this$props.renderedText,
          renderedEl = _this$props.renderedEl,
          item = _this$props.item,
          lazy = _this$props.lazy,
          checked = _this$props.checked,
          isHighlight = _this$props.isHighlight,
          prefixCls = _this$props.prefixCls,
          onClick = _this$props.onClick,
          checkboxPrefixCls = _this$props.checkboxPrefixCls;
      var className = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, "".concat(prefixCls, "-content-item"), true), (0, _defineProperty2["default"])(_classNames, "".concat(prefixCls, "-content-item-disabled"), item.disabled), (0, _defineProperty2["default"])(_classNames, "".concat(prefixCls, "-content-item-highlight"), isHighlight), _classNames));

      var listItem = /*#__PURE__*/_react["default"].createElement("li", {
        className: className,
        title: renderedText,
        onClick: item.disabled ? undefined : function () {
          return onClick(item);
        }
      }, /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
        prefixCls: checkboxPrefixCls,
        checked: checked,
        disabled: item.disabled
      }), /*#__PURE__*/_react["default"].createElement("span", null, renderedEl));

      var children = null;

      if (lazy) {
        var lazyProps = (0, _objectSpread2["default"])({
          height: '0.32rem',
          offset: 500,
          throttle: 0,
          debounce: false
        }, lazy);
        children = /*#__PURE__*/_react["default"].createElement(_reactLazyLoad["default"], (0, _extends2["default"])({}, lazyProps), listItem);
      } else {
        children = listItem;
      }

      return children;
    }
  }]);
  return Item;
}(_react.Component);

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