'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports['default'] = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _tabs = require('choerodon-ui/lib/tabs');

var _tabs2 = _interopRequireDefault(_tabs);

var _dec, _class;

require('choerodon-ui/lib/tabs/style');

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _mobxReact = require('mobx-react');

var _Iframe = require('./Iframe');

var _Iframe2 = _interopRequireDefault(_Iframe);

require('./style.scss');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var TabPane = _tabs2['default'].TabPane;
var IframeWrapper = (_dec = (0, _mobxReact.inject)('MenuStore'), _dec(_class = (0, _mobxReact.observer)(_class = function (_Component) {
  (0, _inherits3['default'])(IframeWrapper, _Component);

  function IframeWrapper() {
    (0, _classCallCheck3['default'])(this, IframeWrapper);
    return (0, _possibleConstructorReturn3['default'])(this, (IframeWrapper.__proto__ || Object.getPrototypeOf(IframeWrapper)).apply(this, arguments));
  }

  (0, _createClass3['default'])(IframeWrapper, [{
    key: 'render',
    value: function render() {
      var MenuStore = this.props.MenuStore;
      var functionCode = MenuStore.activeMenu.functionCode,
          tabs = MenuStore.tabs;


      return _react2['default'].createElement(
        _tabs2['default'],
        { activeKey: functionCode, animated: false },
        MenuStore.getIframeTabs.map(function (tab) {
          return _react2['default'].createElement(
            TabPane,
            {
              tab: 'TAB_IFRAME',
              key: tab.functionCode,
              forceRender: false
            },
            _react2['default'].createElement(_Iframe2['default'], { tab: tab })
          );
        })
      );
    }
  }]);
  return IframeWrapper;
}(_react.Component)) || _class) || _class);
exports['default'] = IframeWrapper;