'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactVirtualized = require('react-virtualized');

var _RendererSelector = require('./RendererSelector.component');

var _RendererSelector2 = _interopRequireDefault(_RendererSelector);

var _PropTypes = require('./PropTypes');

var _PropTypes2 = _interopRequireDefault(_PropTypes);

var _tablerow = require('./utils/tablerow');

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

/**
 * Composable List based on react-virtualized
 */
function VirtualizedList(props) {
	var collection = props.collection,
	    children = props.children,
	    id = props.id,
	    isSelected = props.isSelected,
	    rowHeight = props.rowHeight,
	    selectionToggle = props.selectionToggle,
	    sort = props.sort,
	    sortBy = props.sortBy,
	    sortDirection = props.sortDirection,
	    type = props.type;


	var contentsConfiguration = (0, _tablerow.insertSelectionConfiguration)({
		children: children,
		isSelected: isSelected,
		selectionToggle: selectionToggle
	});

	return _react2.default.createElement(
		_reactVirtualized.AutoSizer,
		null,
		function (_ref) {
			var height = _ref.height,
			    width = _ref.width;
			return _react2.default.createElement(
				_RendererSelector2.default,
				{
					collection: collection,
					height: height,
					id: id,
					isSelected: isSelected,
					rowHeight: rowHeight,
					selectionToggle: selectionToggle,
					sort: sort,
					sortBy: sortBy,
					sortDirection: sortDirection,
					type: type,
					width: width
				},
				contentsConfiguration
			);
		}
	);
}
VirtualizedList.displayName = 'VirtualizedList';
VirtualizedList.propTypes = _PropTypes2.default;

VirtualizedList.Content = _reactVirtualized.Column;

exports.default = VirtualizedList;