'use strict';

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _class, _temp; /**
                    * Created by baoyinghai on 6/28/17.
                    */


var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _tab = require('./tab');

var _ARTSetting = require('./ARTSetting');

var _ARTSetting2 = _interopRequireDefault(_ARTSetting);

var _DSSetting = require('./DSSetting');

var _DSSetting2 = _interopRequireDefault(_DSSetting);

var _index = require('../index');

var _index2 = _interopRequireDefault(_index);

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var PageFactory = (_temp = _class = function (_React$Component) {
  _inherits(PageFactory, _React$Component);

  function PageFactory(props) {
    _classCallCheck(this, PageFactory);

    var _this = _possibleConstructorReturn(this, (PageFactory.__proto__ || Object.getPrototypeOf(PageFactory)).call(this, props));

    _this._changePageIndex = function (index) {
      _this.setState({
        currentPageIndex: index
      });
    };

    _this.state = _extends({
      currentPageIndex: 0
    }, _this.props);
    return _this;
  }

  _createClass(PageFactory, [{
    key: 'render',
    value: function render() {
      var _this2 = this;

      return _react2.default.createElement(
        'div',
        null,
        _react2.default.createElement(
          'div',
          null,
          _react2.default.createElement(
            _tab.TabTitle,
            { onClick: function onClick() {
                return _this2._changePageIndex(0);
              } },
            '\u6E32\u67D3\u6811'
          ),
          _react2.default.createElement(
            _tab.TabTitle,
            { onClick: function onClick() {
                return _this2._changePageIndex(1);
              } },
            '\u6570\u636E\u6E90'
          ),
          _react2.default.createElement(
            _tab.TabTitle,
            { onClick: function onClick() {
                return _this2._changePageIndex(2);
              } },
            '\u9884\u89C8'
          )
        ),
        _react2.default.createElement(
          'div',
          { style: { borderTop: '1px solid #666666' } },
          _react2.default.createElement(
            _tab.TabContainer,
            { currentPageIndex: this.state.currentPageIndex, pageIndex: 0 },
            _react2.default.createElement(_ARTSetting2.default, { ART: this.state.ART })
          ),
          _react2.default.createElement(
            _tab.TabContainer,
            { currentPageIndex: this.state.currentPageIndex, pageIndex: 1 },
            _react2.default.createElement(_DSSetting2.default, { DSC: this.state.DSC })
          ),
          _react2.default.createElement(
            _tab.TabContainer,
            { currentPageIndex: this.state.currentPageIndex, pageIndex: 2 },
            _react2.default.createElement(_index2.default, { ART: this.state.ART, DSC: this.state.DSC })
          )
        )
      );
    }
  }]);

  return PageFactory;
}(_react2.default.Component), _class.defaultProps = {
  DSC: {
    dataSourceA: {
      c: 2, d: 'd'
    },
    dataSourceB: [{ a: '1', b: '2' }, { a: '1', b: '2' }]
  },
  ART: {
    nodeType: 'CONTAINER',
    name: 'LineLayout',
    props: {
      direction: 'column'
    },
    childrenNode: [{
      nodeType: 'COMP',
      name: 'Label',
      sourceFrom: 'dataSourceA',
      dataSource: {
        first: {
          vType: 'expression',
          value: '{$c} + 10'
        }
      }
    }, {
      nodeType: 'COMP',
      name: 'Label',
      sourceFrom: 'dataSourceA',
      dataSource: {
        first: {
          vType: 'key',
          value: 'd'
        }
      }
    }, {
      nodeType: 'COMP',
      name: 'Label',
      props: {}
    }, {
      nodeType: 'CONTAINER',
      name: 'LineLayout',
      props: {
        direction: 'row'
      },
      childrenNode: [{
        nodeType: 'COMP',
        name: 'Label',
        props: {}
      }, {
        nodeType: 'COMP',
        name: 'Label',
        props: {}
      }, {
        nodeType: 'COMP',
        name: 'Label',
        props: {}
      }]
    }]
  }
}, _temp);
exports.default = PageFactory;