'use strict';

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

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _defineProperty2 = require('babel-runtime/helpers/defineProperty');

var _defineProperty3 = _interopRequireDefault(_defineProperty2);

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

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

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 _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _objectAssign = require('object-assign');

var _objectAssign2 = _interopRequireDefault(_objectAssign);

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

var __rest = undefined && undefined.__rest || function (s, e) {
    var t = {};
    for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
    }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
        if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
    }return t;
};

var Row = function (_React$Component) {
    (0, _inherits3["default"])(Row, _React$Component);

    function Row() {
        (0, _classCallCheck3["default"])(this, Row);
        return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
    }

    Row.prototype.render = function render() {
        var _classNames;

        var _a = this.props,
            type = _a.type,
            justify = _a.justify,
            align = _a.align,
            className = _a.className,
            gutter = _a.gutter,
            style = _a.style,
            children = _a.children,
            _a$prefixCls = _a.prefixCls,
            prefixCls = _a$prefixCls === undefined ? 'ant-row' : _a$prefixCls,
            others = __rest(_a, ["type", "justify", "align", "className", "gutter", "style", "children", "prefixCls"]);
        var classes = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, prefixCls, !type), (0, _defineProperty3["default"])(_classNames, prefixCls + '-' + type, type), (0, _defineProperty3["default"])(_classNames, prefixCls + '-' + type + '-' + justify, type && justify), (0, _defineProperty3["default"])(_classNames, prefixCls + '-' + type + '-' + align, type && align), _classNames), className);
        var rowStyle = gutter > 0 ? (0, _objectAssign2["default"])({}, {
            marginLeft: gutter / -2,
            marginRight: gutter / -2
        }, style) : style;
        var cols = _react.Children.map(children, function (col) {
            if (!col) {
                return null;
            }
            if (col.props) {
                return (0, _react.cloneElement)(col, {
                    style: gutter > 0 ? (0, _objectAssign2["default"])({}, {
                        paddingLeft: gutter / 2,
                        paddingRight: gutter / 2
                    }, col.props.style) : col.props.style
                });
            }
            return col;
        });
        return _react2["default"].createElement(
            'div',
            (0, _extends3["default"])({}, others, { className: classes, style: rowStyle }),
            cols
        );
    };

    return Row;
}(_react2["default"].Component);

exports["default"] = Row;

Row.defaultProps = {
    gutter: 0
};
Row.propTypes = {
    type: _react2["default"].PropTypes.string,
    align: _react2["default"].PropTypes.string,
    justify: _react2["default"].PropTypes.string,
    className: _react2["default"].PropTypes.string,
    children: _react2["default"].PropTypes.node,
    gutter: _react2["default"].PropTypes.number,
    prefixCls: _react2["default"].PropTypes.string
};
module.exports = exports['default'];