"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof = require("@babel/runtime/helpers/typeof");

Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")), _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")), _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")), _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")), _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")), _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")), _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")), _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")), _react = _interopRequireWildcard(require("react")), _propTypes = _interopRequireDefault(require("prop-types")), _amosAntd = require("amos-antd"), _CapacityInterface = _interopRequireDefault(require("./CapacityInterface")), _CapacityProperty = _interopRequireDefault(require("./CapacityProperty")), _EditDeviceCapacity = _interopRequireDefault(require("./../deviceAddEdit/EditDeviceCapacity")), _DeviceEnum = require("./../../common/DeviceEnum"), _DeviceLang = require("./../../common/DeviceLang");

function _getRequireWildcardCache(e) {
  if ("function" != typeof WeakMap) return null;
  var t = new WeakMap, r = new WeakMap;
  return (_getRequireWildcardCache = function(e) {
    return e ? r : t;
  })(e);
}

function _interopRequireWildcard(e, t) {
  if (!t && e && e.__esModule) return e;
  if (null === e || "object" !== _typeof(e) && "function" != typeof e) return {
    default: e
  };
  var r = _getRequireWildcardCache(t);
  if (r && r.has(e)) return r.get(e);
  var a = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var l in e) if ("default" !== l && Object.prototype.hasOwnProperty.call(e, l)) {
    var c = i ? Object.getOwnPropertyDescriptor(e, l) : null;
    c && (c.get || c.set) ? Object.defineProperty(a, l, c) : a[l] = e[l];
  }
  return a.default = e, r && r.set(e, a), a;
}

function _createSuper(e) {
  var t = _isNativeReflectConstruct();
  return function() {
    var r, a = (0, _getPrototypeOf2.default)(e);
    if (t) {
      var i = (0, _getPrototypeOf2.default)(this).constructor;
      r = Reflect.construct(a, arguments, i);
    } else r = a.apply(this, arguments);
    return (0, _possibleConstructorReturn2.default)(this, r);
  };
}

function _isNativeReflectConstruct() {
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  if (Reflect.construct.sham) return !1;
  if ("function" == typeof Proxy) return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), 
    !0;
  } catch (e) {
    return !1;
  }
}

require("./../device-detail.scss");

var DeviceCapacityCell = function(e) {
  (0, _inherits2.default)(r, e);
  var t = _createSuper(r);
  function r(e) {
    var a;
    return (0, _classCallCheck2.default)(this, r), a = t.call(this, e), (0, _defineProperty2.default)((0, 
    _assertThisInitialized2.default)(a), "handleEditProperty", (function(e) {
      console.log();
    })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(a), "handleAddProperty", (function(e) {
      console.log();
    })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(a), "deleteCurrentDeviceProperty", (function() {
      var e = a.props.listInfo.id;
      a.props.deleteCapacityProperty(e);
    })), a.state = {
      textEdit: !1
    }, a;
  }
  return (0, _createClass2.default)(r, [ {
    key: "componentDidMount",
    value: function() {}
  }, {
    key: "render",
    value: function() {
      var e = this.props, t = e.listInfo, r = e.deviceId, a = e.capacityId, i = e.getDeviceInfoById, l = e.protocolId, c = e.deviceInterfaces, n = e.visibility, u = e.addCapacityProperty;
      return _react.default.createElement("div", {
        className: "device-cell-detail"
      }, _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
        span: 24
      }, _react.default.createElement("div", {
        className: "device-cell-title"
      }, _react.default.createElement("label", {
        style: {
          color: "black",
          marginLeft: "2rem",
          fontSize: "14px"
        }
      }, "名称"), _react.default.createElement("label", {
        style: {
          color: "black",
          fontSize: "14px"
        }
      }, "：", t.name), 1 === n ? _react.default.createElement(_EditDeviceCapacity.default, (0, 
      _extends2.default)({
        capacityId: a,
        deviceInterfaces: c,
        deviceId: r,
        listInfo: t,
        protocolId: l,
        getDeviceInfoById: i,
        deleteCurrentDeviceProperty: this.deleteCurrentDeviceProperty
      }, this.props)) : null), _react.default.createElement("div", {
        className: "device-cell-content-basic"
      }, _react.default.createElement(_amosAntd.Row, null, _react.default.createElement(_amosAntd.Col, {
        span: 12,
        style: {
          marginLeft: "2rem"
        }
      }, _react.default.createElement("label", {
        className: "device-title-name"
      }, "分类："), _react.default.createElement("label", {
        className: "device-title-value"
      }, (0, _DeviceLang.stringUtil)(_DeviceEnum.capacityClassifyEnum, t.type)), _react.default.createElement("label", {
        className: "device-title-name",
        style: {
          marginLeft: "3rem"
        }
      }, "通信协议："), _react.default.createElement("label", {
        className: "device-title-value"
      }, t.protocolName), _react.default.createElement("label", {
        className: "device-title-name",
        style: {
          marginLeft: "3rem"
        }
      }, "描述："), _react.default.createElement("label", {
        className: "device-title-value"
      }, t.descr)))), _react.default.createElement(_amosAntd.Row, {
        style: {
          height: "100%"
        }
      }, _react.default.createElement(_amosAntd.Col, {
        style: {
          height: "100%"
        },
        span: 24
      }, _react.default.createElement(_CapacityInterface.default, {
        protocolId: l,
        capacityId: a,
        getDeviceInfoById: i,
        deviceId: r,
        visibility: n,
        interfaceInfo: t.interfaceInfo,
        deviceInterfaces: c
      }))), _react.default.createElement(_amosAntd.Row, {
        style: {
          height: "100%"
        }
      }, _react.default.createElement(_amosAntd.Col, {
        style: {
          height: "100%"
        },
        span: 24
      }, _react.default.createElement(_CapacityProperty.default, {
        capacityId: a,
        addCapacityProperty: u,
        getDeviceInfoById: i,
        deviceId: r,
        visibility: n,
        propertyInfo: t.propertyInfo
      }))))));
    }
  } ]), r;
}(_react.Component);

DeviceCapacityCell.displayName = "DeviceCapacityCell", DeviceCapacityCell.propTypes = {
  deleteCapacityProperty: _propTypes.default.func,
  addCapacityProperty: _propTypes.default.func,
  listInfo: _propTypes.default.object,
  deviceId: _propTypes.default.number,
  key: _propTypes.default.number,
  capacityId: _propTypes.default.number,
  getDeviceInfoById: _propTypes.default.func,
  deviceInterfaces: _propTypes.default.array,
  protocolId: _propTypes.default.number
};

var _default = DeviceCapacityCell;

exports.default = _default;