Comparing version 3.9.4 to 3.10.0
@@ -42,3 +42,4 @@ 'use strict'; | ||
columnsPageRange: _react2['default'].PropTypes.array, | ||
columnsPageSize: _react2['default'].PropTypes.number | ||
columnsPageSize: _react2['default'].PropTypes.number, | ||
expandIconColumnIndex: _react2['default'].PropTypes.number | ||
}, | ||
@@ -68,3 +69,4 @@ | ||
indentSize: 15, | ||
columnsPageSize: 5 | ||
columnsPageSize: 5, | ||
expandIconColumnIndex: 0 | ||
}; | ||
@@ -183,2 +185,4 @@ }, | ||
var onRowClick = props.onRowClick; | ||
var expandIconColumnIndex = props.expandIconColumnIndex; | ||
for (var i = 0; i < data.length; i++) { | ||
@@ -210,2 +214,3 @@ var record = data[i]; | ||
columns: columns, | ||
expandIconColumnIndex: expandIconColumnIndex, | ||
onRowClick: onRowClick, | ||
@@ -212,0 +217,0 @@ key: key })); |
@@ -18,6 +18,16 @@ 'use strict'; | ||
onDestroy: _react2['default'].PropTypes.func, | ||
onRowClick: _react2['default'].PropTypes.func, | ||
record: _react2['default'].PropTypes.object, | ||
prefixCls: _react2['default'].PropTypes.string | ||
prefixCls: _react2['default'].PropTypes.string, | ||
expandIconColumnIndex: _react2['default'].PropTypes.number | ||
}, | ||
getDefaultProps: function getDefaultProps() { | ||
return { | ||
onRowClick: function onRowClick() {}, | ||
onDestroy: function onDestroy() {}, | ||
expandIconColumnIndex: 0 | ||
}; | ||
}, | ||
componentWillUnmount: function componentWillUnmount() { | ||
@@ -41,2 +51,3 @@ this.props.onDestroy(this.props.record); | ||
var onRowClick = props.onRowClick; | ||
var expandIconColumnIndex = props.expandIconColumnIndex; | ||
@@ -49,3 +60,3 @@ for (var i = 0; i < columns.length; i++) { | ||
var expandIcon = null; | ||
var expandIcon = undefined; | ||
var tdProps = undefined; | ||
@@ -55,13 +66,12 @@ var colSpan = undefined; | ||
var notRender = false; | ||
var indentText = undefined; | ||
if (i === 0 && expandable) { | ||
expandIcon = _react2['default'].createElement('span', { | ||
className: prefixCls + '-expand-icon ' + prefixCls + '-' + (expanded ? 'expanded' : 'collapsed'), | ||
if (expandable) { | ||
expandIcon = _react2['default'].createElement('span', { className: prefixCls + '-expand-icon ' + prefixCls + '-' + (expanded ? 'expanded' : 'collapsed'), | ||
onClick: props.onExpand.bind(null, !expanded, record) }); | ||
} else if (i === 0 && needIndentSpaced) { | ||
expandIcon = _react2['default'].createElement('span', { | ||
className: prefixCls + '-expand-icon ' + prefixCls + '-spaced' }); | ||
} else if (needIndentSpaced) { | ||
expandIcon = _react2['default'].createElement('span', { className: prefixCls + '-expand-icon ' + prefixCls + '-spaced' }); | ||
} | ||
var isColumnHaveExpandIcon = i === expandIconColumnIndex; | ||
if (expandIconAsCell && i === 0) { | ||
@@ -74,3 +84,3 @@ cells.push(_react2['default'].createElement( | ||
)); | ||
expandIcon = null; | ||
isColumnHaveExpandIcon = false; | ||
} | ||
@@ -93,3 +103,4 @@ | ||
indentText = i === 0 ? _react2['default'].createElement('span', { style: { paddingLeft: indentSize * indent + 'px' }, className: prefixCls + '-indent indent-level-' + indent }) : null; | ||
var indentText = _react2['default'].createElement('span', { style: { paddingLeft: indentSize * indent + 'px' }, | ||
className: prefixCls + '-indent indent-level-' + indent }); | ||
@@ -99,5 +110,8 @@ if (!notRender) { | ||
'td', | ||
{ key: col.key, colSpan: colSpan, rowSpan: rowSpan, className: '' + colClassName }, | ||
indentText, | ||
expandIcon, | ||
{ key: col.key, | ||
colSpan: colSpan, | ||
rowSpan: rowSpan, | ||
className: colClassName }, | ||
isColumnHaveExpandIcon ? indentText : null, | ||
isColumnHaveExpandIcon ? expandIcon : null, | ||
text | ||
@@ -109,3 +123,5 @@ )); | ||
'tr', | ||
{ onClick: onRowClick ? onRowClick.bind(null, record, index) : null, className: prefixCls + ' ' + props.className, style: { display: props.visible ? '' : 'none' } }, | ||
{ onClick: onRowClick.bind(null, record, index), | ||
className: prefixCls + ' ' + props.className, | ||
style: { display: props.visible ? '' : 'none' } }, | ||
cells | ||
@@ -112,0 +128,0 @@ ); |
{ | ||
"name": "rc-table", | ||
"version": "3.9.4", | ||
"version": "3.10.0", | ||
"description": "table ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -130,2 +130,8 @@ # rc-table | ||
<tr> | ||
<td>expandIconColumnIndex</td> | ||
<td>Number</td> | ||
<th>0</th> | ||
<td>The index of expandIcon which column will be inserted when expandIconAsCell is false</td> | ||
</tr> | ||
<tr> | ||
<td>rowKey</td> | ||
@@ -132,0 +138,0 @@ <td>Function(recode,index):string</td> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29154
585
271
0