Comparing version 0.0.15 to 0.0.16
@@ -7,2 +7,5 @@ import React from 'react'; | ||
super(args); | ||
this.state = { | ||
activeIndex: null | ||
} | ||
} | ||
@@ -37,11 +40,48 @@ | ||
const BodyStyle = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.style || []; | ||
const BodyActiveStyle = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.activeStyle || []; | ||
return BodyData.map((trs, trindex) => { | ||
const tds = trs.map(td => this.getTdContent(td)); | ||
return <tr style={BodyStyle} key={`tableBody${trindex}`} onClick={this.click.bind(this, trs, trindex)}>{tds}</tr>; | ||
const isActive = this.state.activeIndex === trindex; | ||
let style = BodyStyle; | ||
if (isActive) { | ||
const oldStyle = JSON.parse(JSON.stringify(BodyStyle)); | ||
for (var i in BodyActiveStyle) { | ||
oldStyle[i] = BodyActiveStyle[i]; | ||
} | ||
style = oldStyle; | ||
} | ||
return ( | ||
<tr | ||
className={isActive ? 'active' : ''} | ||
style={style} key={`tableBody${trindex}`} | ||
onClick={this.click.bind(this, trs, trindex)} | ||
onMouseEnter={this.onMouseEnter.bind(this, trs, trindex)} | ||
onMouseOut={this.onMouseOut.bind(this, trs, trindex)} | ||
onMouseMove={this.onMouseMove.bind(this, trs, trindex)} | ||
> | ||
{tds} | ||
</tr> | ||
); | ||
}) | ||
} | ||
onMouseMove(item, index) { | ||
const clickEvt = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.mousemove; | ||
clickEvt && clickEvt(item, index); | ||
} | ||
onMouseOut(item, index) { | ||
const clickEvt = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.mouseout; | ||
clickEvt && clickEvt(item, index); | ||
} | ||
onMouseEnter(item, index) { | ||
const clickEvt = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.mouseenter; | ||
clickEvt && clickEvt(item, index); | ||
} | ||
click(item, index) { | ||
const clickEvt = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.click; | ||
clickEvt && clickEvt(item, index); | ||
this.setState({ | ||
activeIndex: index | ||
}) | ||
} | ||
@@ -48,0 +88,0 @@ |
{ | ||
"name": "hui-ui", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "hui-ui", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,2 +14,3 @@ /** | ||
'chart/chart': './src/chart/chart.jsx', | ||
'option/option': './src/option/option.jsx', | ||
vendor: ['react', 'react-dom'] | ||
@@ -16,0 +17,0 @@ }, |
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
159913
14
409