UNPKG

1.68 kBJavaScriptView Raw
1import _extends from 'babel-runtime/helpers/extends';
2import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4import _inherits from 'babel-runtime/helpers/inherits';
5
6var _class, _temp;
7
8import React from 'react';
9import PropTypes from 'prop-types';
10import classnames from 'classnames';
11import Row from '../expanded/row';
12
13/* eslint-disable react/prefer-stateless-function */
14var SelectionRow = (_temp = _class = function (_React$Component) {
15 _inherits(SelectionRow, _React$Component);
16
17 function SelectionRow() {
18 _classCallCheck(this, SelectionRow);
19
20 return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
21 }
22
23 SelectionRow.prototype.render = function render() {
24 var _classnames;
25
26 /* eslint-disable no-unused-vars*/
27 var _props = this.props,
28 className = _props.className,
29 record = _props.record,
30 primaryKey = _props.primaryKey;
31 var selectedRowKeys = this.context.selectedRowKeys;
32
33 var cls = classnames((_classnames = {
34 selected: selectedRowKeys.indexOf(record[primaryKey]) > -1
35 }, _classnames[className] = className, _classnames));
36 return React.createElement(Row, _extends({}, this.props, { className: cls }));
37 };
38
39 return SelectionRow;
40}(React.Component), _class.propTypes = _extends({}, Row.propTypes), _class.defaultProps = _extends({}, Row.defaultProps), _class.contextTypes = {
41 selectedRowKeys: PropTypes.array
42}, _temp);
43SelectionRow.displayName = 'SelectionRow';
44export { SelectionRow as default };
\No newline at end of file