1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _isArray2 = require('lodash/isArray');
|
8 |
|
9 | var _isArray3 = _interopRequireDefault(_isArray2);
|
10 |
|
11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12 |
|
13 | function resolveRowKey(_ref) {
|
14 | var rowData = _ref.rowData,
|
15 | rowIndex = _ref.rowIndex,
|
16 | rowKey = _ref.rowKey;
|
17 |
|
18 | if (typeof rowKey === 'function') {
|
19 | return rowKey({ rowData: rowData, rowIndex: rowIndex }) + '-row';
|
20 | } else if (process.env.NODE_ENV !== 'production') {
|
21 |
|
22 | if (!(0, _isArray3.default)(rowData) && !{}.hasOwnProperty.call(rowData, rowKey)) {
|
23 | console.warn(
|
24 | 'Table.Body - Missing valid rowKey!', rowData, rowKey);
|
25 | }
|
26 | }
|
27 |
|
28 | if (rowData[rowKey] === 0) {
|
29 | return rowData[rowKey] + '-row';
|
30 | }
|
31 |
|
32 | return (rowData[rowKey] || rowIndex) + '-row';
|
33 | }
|
34 |
|
35 | exports.default = resolveRowKey; |
\ | No newline at end of file |