'use strict';

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

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 _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

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

// import pureRender from 'pure-render-decorator';
// @pureRender
var Dropload = function (_Component) {
	(0, _inherits3.default)(Dropload, _Component);

	function Dropload(props, context) {
		(0, _classCallCheck3.default)(this, Dropload);
		return (0, _possibleConstructorReturn3.default)(this, (Dropload.__proto__ || Object.getPrototypeOf(Dropload)).call(this, props, context));
	}

	(0, _createClass3.default)(Dropload, [{
		key: 'render',
		value: function render() {
			var _props = this.props,
			    status = _props.status,
			    scrollText = _props.scrollText,
			    pullText = _props.pullText,
			    type = _props.type,
			    pulledY = _props.pulledY,
			    show = _props.show,
			    isEnd = _props.isEnd,
			    currentPage = _props.currentPage,
			    itemArr = _props.itemArr;

			if (!show) return null;
			return _react2.default.createElement(
				'div',
				{ className: '_dropload _' + type, style: { transform: 'translateY(' + pulledY + 'px)' } },
				_react2.default.createElement(
					'div',
					{ className: '_status' },
					(type === "scroll" && status == 1 || type === "pull" && status == 3) && _react2.default.createElement('span', { className: '_loading' }),
					currentPage === 1 && itemArr.length === 0 ? _react2.default.createElement(
						'span',
						{ className: 'g-fs-26' },
						scrollText[4]
					) : _react2.default.createElement(
						'div',
						null,
						type === "scroll" && _react2.default.createElement(
							'span',
							null,
							scrollText[status]
						)
					)
				)
			);
		}
	}]);
	return Dropload;
}(_react.Component);

Dropload.defaultProps = {
	/**
  * 上“滑”加载
  * 由redux管理，通过status的在redux存储来控制
  */
	scrollText: ['上拉加载', '加载中', '已全部加载', '网络不稳定，请稍后重试', '没有内容可供显示'],
	/**
  * 下“拉”加载
  */
	pullText: ['↓ 下拉刷新', '↓ 下拉刷新', '↑ 释放更新', '加载中...'],
	/**
  * 默认上滑
  * scroll / down
  */
	type: "scroll",
	// 下拉刷新的位置
	pulledY: 0
};
// 大部分同PullView的props
Dropload.propTypes = {
	/**
  * 状态
  */
	status: _propTypes2.default.number
};
exports.default = Dropload;