"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = ImageRender;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
function ImageRender(value, column, rowData) {
  if (!value || typeof value !== 'string') {
    return /*#__PURE__*/_react["default"].createElement("div", {
      style: {
        color: '#F04631'
      }
    }, "\u6570\u636E\u683C\u5F0F\u4E0D\u5408\u89C4\uFF0C\u8BF7\u8FD4\u56DE\u5B57\u7B26\u4E32\u5F62\u5F0F\uFF01");
  }
  var imageProps = column.imageProps || {
    width: 80,
    height: 80,
    borderRadius: 4
  };
  var imageWrapProps = column.imageWrapProps || {
    display: 'inline-block',
    padding: 4,
    background: '#eee',
    borderRadius: 4,
    height: 88,
    width: 88
  };
  var onClick = imageProps.onClick,
    width = imageProps.width;
  var renderImageProps = {
    src: value,
    width: width,
    style: (0, _extends2["default"])({}, imageProps),
    onClick: function (_onClick) {
      function onClick(_x) {
        return _onClick.apply(this, arguments);
      }
      onClick.toString = function () {
        return _onClick.toString();
      };
      return onClick;
    }(function (e) {
      if (onClick && typeof onClick === 'function') {
        onClick(e, column, rowData);
        e.stopPropagation();
      }
    })
  };
  return /*#__PURE__*/_react["default"].createElement("i", {
    style: (0, _extends2["default"])({}, imageWrapProps)
  }, /*#__PURE__*/_react["default"].createElement("img", renderImageProps));
}
;