Les sommes imbriquées se révèlent au clic

pull/96/head
mama 2017-10-13 12:40:25 +02:00
parent 64a4e85507
commit 2fa6a8d59c
1 changed files with 6 additions and 2 deletions

View File

@ -20,21 +20,25 @@ let Table = ({explanation}) => <table>
</table>
/* La colonne peut au clic afficher une nouvelle colonne qui sera une autre somme imbriquée */
class Row extends Component {
state = {
folded: true
}
render() {
let {v, i} = this.props,
rowFormula = path(["explanation", "formule", "explanation"], v),
isSomme = rowFormula && rowFormula.name == "somme"
return [
<tr key={v.name} className={isSomme ? "" : "noNest"}>
<tr key={v.name} className={isSomme ? "" : "noNest"} onClick={() => this.setState({folded: false})}>
<td className="operator blank">{i != 0 && "+"}</td>
<td className="element">{makeJsx(v)}</td>
<td className="situationValue value">
<NodeValue data={v.nodeValue} />
</td>
</tr>,
...(isSomme
...(isSomme && !this.state.folded
? [
<tr className="nested">
<td className="blank" />