Comparing version 0.0.18 to 0.0.19
@@ -8,3 +8,3 @@ import React from 'react'; | ||
this.state = { | ||
activeIndex: null | ||
activeIndex: this.props.activeIndex || null | ||
} | ||
@@ -41,5 +41,6 @@ } | ||
const BodyActiveStyle = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.activeStyle || []; | ||
const BodyListClass = this.props.dataSource && this.props.dataSource.body && this.props.dataSource.body.className || ''; | ||
return BodyData.map((trs, trindex) => { | ||
const tds = trs.map(td => this.getTdContent(td)); | ||
const isActive = this.state.activeIndex === trindex; | ||
const isActive = (this.props.activeIndex === undefined ? this.state.activeIndex : this.props.activeIndex) === trindex; | ||
let style = BodyStyle; | ||
@@ -55,3 +56,3 @@ if (isActive) { | ||
<tr | ||
className={isActive ? 'active' : ''} | ||
className={`${isActive ? 'active' : ''} ${BodyListClass}`} | ||
style={style} key={`tableBody${trindex}`} | ||
@@ -90,3 +91,3 @@ onClick={this.click.bind(this, trs, trindex)} | ||
} | ||
this.tipsDom.style.left = left + 'px'; | ||
@@ -136,3 +137,3 @@ this.tipsDom.style.top = y + 'px'; | ||
this.setState({ | ||
activeIndex: index | ||
activeIndex: this.props.activeIndex || index | ||
}) | ||
@@ -139,0 +140,0 @@ } |
{ | ||
"name": "hui-ui", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "hui-ui", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
162126
449