var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _Types=require("./Types");var _InjectionSystem=_interopRequireDefault(require("./systems/InjectionSystem"));var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\src\\lib\\Module.js";var Module=function(_React$Component){(0,_inherits2.default)(Module,_React$Component);function Module(props){var _this;(0,_classCallCheck2.default)(this,Module);_this=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(Module).call(this,props));_this.Core=_InjectionSystem.default.inject('Core');_this.Modules=_InjectionSystem.default.inject('Modules');var ModuleID=props.ModuleID,EventSystem=props.EventSystem;var eventName=ModuleID+"HitCheck";EventSystem&&EventSystem.on(eventName,function(_ref){var x=_ref.x,y=_ref.y;return true;});_this.isTemplate=false;_this._containerStyle={marginLeft:24,marginRight:24};_this.counter=0;return _this;}(0,_createClass2.default)(Module,[{key:"getId",value:function getId(){return this.props.ModuleID;}},{key:"renderModule",value:function renderModule(ctor){var namespace=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"default";var props=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var VS=this.props.CoreSystem.ViewSystem;if(!this.props.CoreSystem.ModuleSystem.get(ctor,namespace))return null;return VS.renderModule({value:ctor,namespace:namespace,props:props},this.getId()+"C"+this.counter++);}},{key:"createAction",value:function createAction(action){if(!this.props.CoreSystem){console.warn("This module was constructed without a CoreSystem");return;}return this.props.CoreSystem.ActionSystem.createAction(action);}},{key:"setContainerStyle",value:function setContainerStyle(style){this._containerStyle=style;}},{key:"display",value:function display(){throw new Error("You must extend this base Module and override display method!");}},{key:"module",value:function module(mod,props){return mod?this.renderModule(mod.value,mod.namespace,props):null;}},{key:"moduleArray",value:function moduleArray(modules,props){var _this2=this;return modules?modules.map(function(mod){return _this2.module(mod,props);}):null;}},{key:"render",value:function render(){this.counter=10100;return _react.default.createElement(_reactNative.View,{ModuleID:this.props.ModuleID,style:[{overflow:'hidden'}],MY_WRAPPER_FROM_BASE_MODULE:true,__source:{fileName:_jsxFileName,lineNumber:73}},this.display());}},{key:"getProps",value:function getProps(){return(0,_Types.Resolver)(this.constructor.Inputs,this.props);}}]);return Module;}(_react.default.Component);exports.default=Module;