var _excluded = ["title", "editable", "dataIndex", "field_type", "record", "handleSave", "action", "contentClassName"];
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from "react";
import { useSharedState } from "../../../../../../hooks";
import { Context } from "../../../../model";
import classNames from "classnames";
import "./index.less";
import { getValueByKeys } from "../../utils";
var Show = function Show(props) {
  var modal = useSharedState(Context);
  var title = props.title,
    editable = props.editable,
    dataIndex = props.dataIndex,
    field_type = props.field_type,
    record = props.record,
    handleSave = props.handleSave,
    action = props.action,
    contentClassName = props.contentClassName,
    restProps = _objectWithoutProperties(props, _excluded);
  var onClick = function onClick() {
    var _modal$state, _modal$state$utils;
    if (action && modal !== null && modal !== void 0 && (_modal$state = modal.state) !== null && _modal$state !== void 0 && (_modal$state$utils = _modal$state.utils) !== null && _modal$state$utils !== void 0 && _modal$state$utils.action) {
      var _modal$state2, _modal$state2$utils;
      modal === null || modal === void 0 ? void 0 : (_modal$state2 = modal.state) === null || _modal$state2 === void 0 ? void 0 : (_modal$state2$utils = _modal$state2.utils) === null || _modal$state2$utils === void 0 ? void 0 : _modal$state2$utils.action({
        type: action,
        data: record
      });
    }
  };
  return /*#__PURE__*/React.createElement("div", {
    className: classNames(contentClassName || "", {
      "table-fields-text-link": action
    }, contentClassName),
    onClick: onClick
  }, getValueByKeys(record, dataIndex));
};
export default Show;