"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"), _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _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")), _amosFramework = require("amos-framework");

function _createSuper(e) {
    var t = _isNativeReflectConstruct();
    return function() {
        var r, i = (0, _getPrototypeOf2.default)(e);
        if (t) {
            var a = (0, _getPrototypeOf2.default)(this).constructor;
            r = Reflect.construct(i, arguments, a);
        } else r = i.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;
    }
}

var DeviceConfigInfo = function(e) {
    (0, _inherits2.default)(r, e);
    var t = _createSuper(r);
    function r(e) {
        var i;
        return (0, _classCallCheck2.default)(this, r), i = t.call(this, e), (0, _defineProperty2.default)((0, 
        _assertThisInitialized2.default)(i), "onAttributeChange", (function(e, t) {
            var r = i.state.deviceConfigParam, a = i.props.updateDevicePropertyCell;
            r[e] = t.target.value, a(r), i.setState({
                deviceConfigParam: r
            });
        })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(i), "getDeviceConfigInfo", (function() {
            var e = i.props, t = e.device, r = e.updateDevicePropertyCell, a = e.equipment, n = e.enable, o = i.state.deviceConfigParam, l = [];
            return t.attributes.map((function(e) {
                var t = o["equip_".concat(e.id)];
                if (void 0 === t) if (void 0 !== a && void 0 !== a.id) {
                    var u = a.cfgParamMap;
                    t = u["equip_".concat(e.id)] ? u["equip_".concat(e.id)] : t;
                } else t = e.valueStr;
                o["equip_".concat(e.id)] = t, r(o), l.push(_react.default.createElement("div", {
                    key: e.id,
                    className: "template-config-common"
                }, _react.default.createElement("div", {
                    className: "property-label-name",
                    title: e.displayName
                }, e.displayName, "："), n ? _react.default.createElement(_amosFramework.Input, {
                    value: t,
                    onChange: function(t) {
                        return i.onAttributeChange("equip_".concat(e.id), t);
                    },
                    style: {
                        width: "152px"
                    },
                    placeholder: "请输入"
                }) : _react.default.createElement("div", {
                    className: "property-normal-label",
                    title: t
                }, t)));
            })), l;
        })), i.state = {
            deviceConfigParam: {}
        }, i;
    }
    return (0, _createClass2.default)(r, [ {
        key: "componentWillMount",
        value: function() {}
    }, {
        key: "componentDidMount",
        value: function() {}
    }, {
        key: "componentWillReceiveProps",
        value: function(e) {}
    }, {
        key: "componentWillUnmount",
        value: function() {}
    }, {
        key: "render",
        value: function() {
            return _react.default.createElement("div", {
                className: "add-device-left-config"
            }, _react.default.createElement("div", {
                className: "template-config-info-title"
            }, "设备属性"), _react.default.createElement("div", {
                className: "template-config-info-content"
            }, this.getDeviceConfigInfo()));
        }
    } ]), r;
}(_react.Component);

DeviceConfigInfo.displayName = "DeviceConfigInfo", DeviceConfigInfo.propTypes = {
    device: _propTypes.default.object,
    equipment: _propTypes.default.object,
    updateDevicePropertyCell: _propTypes.default.func,
    enable: _propTypes.default.bool
}, DeviceConfigInfo.defaultProps = {
    enable: !0
};

var _default = DeviceConfigInfo;

exports.default = _default;