"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = linkRender;
var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
function linkRender(value, column, rowData, _onClick) {
  if (value === undefined || value === null) {
    return '';
  }
  var renderProps = {
    text: true,
    type: 'primary',
    className: "deep-table-link-button",
    title: typeof value == 'object' ? value.title : value,
    style: (0, _extends2["default"])({}, rowData.style || {}),
    onClick: function onClick() {
      _onClick && typeof _onClick === 'function' && _onClick();
      if (typeof value === 'object' && value.href) {
        location.href = value.href;
      } else if (typeof value == 'string') {
        location.href = value;
      }
    }
  };
  return /*#__PURE__*/_react["default"].createElement(_button["default"], renderProps, typeof value == 'object' ? value.title : value);
}
;