1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
3 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
4 | import _inherits from 'babel-runtime/helpers/inherits';
|
5 |
|
6 | var _class, _temp;
|
7 |
|
8 | import React from 'react';
|
9 | import PropTypes from 'prop-types';
|
10 | import classnames from 'classnames';
|
11 | import Row from '../expanded/row';
|
12 |
|
13 |
|
14 | var 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 |
|
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);
|
43 | SelectionRow.displayName = 'SelectionRow';
|
44 | export { SelectionRow as default }; |
\ | No newline at end of file |