"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = enumRender;
var _react = _interopRequireDefault(require("react"));
function enumRender(cellData, column) {
  if (!cellData && cellData !== 0) {
    return '';
  }
  var enumData = column.enumData,
    enumBadgeType = column.enumBadgeType;
  if (!enumData || !Array.isArray(enumData) || enumData.length === 0) {
    return cellData;
  }
  var found = enumData.find(function (item) {
    return item.value === cellData;
  });
  var color = 'black';
  var theme = 'background';
  if (!found) {
    return cellData;
  }
  if (found.color) {
    color = found.color;
    if (enumBadgeType) {
      theme = enumBadgeType;
    }
    var className = "deep-table-badge deep-table-badge-" + theme + "-" + color;
    return /*#__PURE__*/_react["default"].createElement("span", {
      className: className
    }, found.text);
  }
  return found.text;
}
;