Comparing version 3.3.0 to 3.4.0
# History | ||
---- | ||
## 3.3.0 / 2015-10-27 | ||
@@ -5,0 +6,0 @@ |
@@ -110,7 +110,9 @@ 'use strict'; | ||
return ths.map(function (c) { | ||
return _react2['default'].createElement( | ||
'th', | ||
{ key: c.key, className: c.className || '' }, | ||
c.title | ||
); | ||
if (c.colSpan !== 0) { | ||
return _react2['default'].createElement( | ||
'th', | ||
{ key: c.key, colSpan: c.colSpan, className: c.className || '' }, | ||
c.title | ||
); | ||
} | ||
}); | ||
@@ -117,0 +119,0 @@ }, |
@@ -44,2 +44,7 @@ 'use strict'; | ||
var expandIcon = null; | ||
var tdProps = undefined; | ||
var colSpan = undefined; | ||
var rowSpan = undefined; | ||
var notRender = false; | ||
var align = 'left'; | ||
@@ -63,11 +68,24 @@ if (i === 0 && expandable) { | ||
if (render) { | ||
text = render(text, record, index); | ||
text = render(text, record, index) || {}; | ||
tdProps = text.props || {}; | ||
if (!_react2['default'].isValidElement(text)) { | ||
text = text.children; | ||
} | ||
rowSpan = tdProps.rowSpan; | ||
colSpan = tdProps.colSpan; | ||
align = tdProps.align || 'left'; | ||
} | ||
cells.push(_react2['default'].createElement( | ||
'td', | ||
{ key: col.key, className: '' + colClassName }, | ||
expandIcon, | ||
text | ||
)); | ||
if (rowSpan === 0 || colSpan === 0) { | ||
notRender = true; | ||
} | ||
if (!notRender) { | ||
cells.push(_react2['default'].createElement( | ||
'td', | ||
{ key: col.key, style: { textAlign: align }, colSpan: colSpan, rowSpan: rowSpan, className: '' + colClassName }, | ||
expandIcon, | ||
text | ||
)); | ||
} | ||
} | ||
@@ -74,0 +92,0 @@ return _react2['default'].createElement( |
{ | ||
"name": "rc-table", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "table ui component for react", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"jquery": "^1.11.2", | ||
"precommit-hook": "^1.0.7", | ||
"precommit-hook-eslint": "3.x", | ||
"rc-dropdown": "~1.1.2", | ||
@@ -53,5 +53,5 @@ "rc-menu": "~3.4.0", | ||
}, | ||
"precommit": [ | ||
"pre-commit": [ | ||
"lint" | ||
] | ||
} |
@@ -51,4 +51,16 @@ # rc-table | ||
var columns = [ | ||
{title: '表头1', dataIndex: 'a', key:'a',width: 100}, | ||
{id: '123', title: '表头2', dataIndex: 'b', key:'b', width: 100}, | ||
{title: '表头1', dataIndex: 'a', colSpan: 2,key:'a',width: 100}, | ||
{id: '123', title: '表头2', dataIndex: 'b', colSpan: 0,key:'b', width: 100, render: function(o, row, index){ | ||
let obj ={ | ||
children:o, | ||
props:{} | ||
} | ||
if(index === 0){ | ||
obj.props.rowSpan = 2; | ||
} | ||
if(index === 1){ | ||
obj.props.rowSpan = 0; | ||
} | ||
return obj; | ||
}}, | ||
{title: '表头3', dataIndex: 'c', key:'c',width: 200}, | ||
@@ -101,2 +113,8 @@ { | ||
<tr> | ||
<td>colSpan</td> | ||
<td>Number</td> | ||
<th></th> | ||
<td>thead colSpan of this column</td> | ||
</tr> | ||
<tr> | ||
<td>useFixedHeader</td> | ||
@@ -184,6 +202,6 @@ <td>Boolean</td> | ||
<tr> | ||
<td>renderer</td> | ||
<td>Function(value, record)</td> | ||
<td>render</td> | ||
<td>Function(value, row, index)</td> | ||
<th></th> | ||
<td>The render function of cell, has two params: the text of this cell and the record of this row</td> | ||
<td>The render function of cell, has three params: the text of this cell, the record of this row, the index of this row, it's return an object:{children: value, props:{align:'center', colSpan: 1, rowSpan:1}}==>'children' is the text of this cell, props is some setting of this cell, eg: 'align' set text-align, 'colspan' set td colspan, 'rowspan' set td rowspan</td> | ||
</tr> | ||
@@ -190,0 +208,0 @@ </tbody> |
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
18780
326
223