import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';
var TableCell = function TableCell(_ref) {
  var columns = _ref.columns,
    row = _ref.row,
    rowIndex = _ref.rowIndex,
    emptyText = _ref.emptyText,
    onCellClick = _ref.onCellClick;
  /* eslint-disable react/jsx-no-useless-fragment */
  return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
    var currentRowValue = row[column.prop];
    var cellValue = currentRowValue || emptyText;
    var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
    return /*#__PURE__*/React.createElement("td", {
      style: _extends({
        fontSize: "".concat(column === null || column === void 0 ? void 0 : column.fontSize),
        textAlign: column !== null && column !== void 0 && column.align ? "".concat(column === null || column === void 0 ? void 0 : column.align, " !important") : 'left',
        paddingLeft: '0.3rem',
        paddingRight: '0.3rem',
        color: "".concat(column === null || column === void 0 ? void 0 : column.color),
        boxSizing: 'border-box',
        whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
      }, currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.style),
      "data-column": column.prop,
      key: "row-td-".concat(index, "-").concat(column.prop.toString()),
      onClick: function onClick() {
        return onCellClick && onCellClick(currentRowValue, rowIndex, index);
      },
      className: column.className
    }, /*#__PURE__*/React.createElement("div", {
      className: "cell"
    }, shouldBeRenderElement ? shouldBeRenderElement : cellValue));
  }));
  /* eslint-enable */
};
export default TableCell;