"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 _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")), _amosFramework = require("amos-framework"), _amosJsplumb = require("amos-jsplumb"), _plumbOptions = require("./modelConf/plumbOptions"), _elelist = _interopRequireDefault(require("./elelist"));

function _createSuper(e) {
    var t = _isNativeReflectConstruct();
    return function() {
        var r, o = (0, _getPrototypeOf2.default)(e);
        if (t) {
            var n = (0, _getPrototypeOf2.default)(this).constructor;
            r = Reflect.construct(o, arguments, n);
        } else r = o.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 RuleScene = function(e) {
    (0, _inherits2.default)(r, e);
    var t = _createSuper(r);
    function r() {
        var e;
        (0, _classCallCheck2.default)(this, r);
        for (var o = arguments.length, n = new Array(o), l = 0; l < o; l++) n[l] = arguments[l];
        return e = t.call.apply(t, [ this ].concat(n)), (0, _defineProperty2.default)((0, 
        _assertThisInitialized2.default)(e), "handleDragOver", (function(e) {
            (0, _amosJsplumb.stopEvent)(e);
        })), e;
    }
    return (0, _createClass2.default)(r, [ {
        key: "render",
        value: function() {
            var e = _amosJsplumb.setting.defaultSettings, t = {
                connections: {
                    dotted: _amosJsplumb.setting.dottedConnectionStyle,
                    selected: _amosJsplumb.setting.selectedConnectionStyle
                },
                endpoints: {}
            }, r = this.props, o = r.zoom, n = r.handleDrop, l = r.onPlumbChange, u = r.onSceneCreated, a = r.destroy, s = r.onPlumbClick, i = r.eventListeners, p = r.onAddConnection, c = r.onRemoveConnection, d = r.onRemoveNode, f = r.onZoom, _ = r.newRestProps, m = r.nodeProps, b = this.props.dataSource, y = b.nodes, h = b.connections;
            return _react.default.createElement("div", {
                className: "rule-scene",
                onDragOver: this.handleDragOver,
                onDrop: n
            }, _react.default.createElement(_amosFramework.Spin, {
                type: "grid",
                loading: a,
                color: "#26A65B",
                className: "grid-loading"
            }), _react.default.createElement(_amosJsplumb.AmosPlumb, (0, _extends2.default)({
                className: "amos-plumb-container",
                key: "amos-plumb",
                onAddConnection: p,
                onRemoveConnection: c,
                onRemoveNode: d,
                jsPlumbSettings: e,
                registerTypes: t,
                onChange: l,
                onCreated: u,
                connections: h,
                nodes: y,
                onPlumbClick: s,
                eventListeners: i,
                zoom: o,
                nodeProps: m,
                onZoom: f,
                showControl: !0,
                getNodeContent: _elelist.default,
                destroy: a,
                draggableOptions: {
                    constrain: !0
                }
            }, _)));
        }
    } ]), r;
}(_react.Component);

(0, _defineProperty2.default)(RuleScene, "propTypes", {
    zoom: _propTypes.default.number,
    dataSource: _propTypes.default.object,
    handleDrop: _propTypes.default.func,
    onPlumbChange: _propTypes.default.func,
    onSceneCreated: _propTypes.default.func,
    onPlumbClick: _propTypes.default.func,
    destroy: _propTypes.default.bool,
    eventListeners: _propTypes.default.object,
    onAddConnection: _propTypes.default.func,
    onRemoveConnection: _propTypes.default.func,
    onRemoveNode: _propTypes.default.func,
    onZoom: _propTypes.default.func,
    newRestProps: _propTypes.default.object
}), RuleScene.displayName = "RuleScene";

var _default = RuleScene;

exports.default = _default;