(data, value=this.state.value)
| 44 | } |
| 45 | |
| 46 | formatData (data, value=this.state.value) { |
| 47 | data = toTextValue(data, this.props.textTpl, this.props.valueTpl).map((d) => { |
| 48 | d.$checked = value.indexOf(d.$value) >= 0; |
| 49 | return d; |
| 50 | }); |
| 51 | |
| 52 | Children.map(this.props.children, (child) => { |
| 53 | if (typeof child === 'object') { |
| 54 | let position = child.props.position; |
| 55 | if (position === undefined) { |
| 56 | position = data.length; |
| 57 | } |
| 58 | data = [ |
| 59 | ...data.slice(0, position), |
| 60 | { |
| 61 | $checked: value.indexOf(child.props.checkValue) >= 0, |
| 62 | $value: child.props.checkValue, |
| 63 | $text: child.props.children || child.props.text, |
| 64 | $key: hashcode(`${child.props.checkValue}-${child.props.text}`) |
| 65 | }, |
| 66 | ...data.slice(position) |
| 67 | ]; |
| 68 | } |
| 69 | }); |
| 70 | return data; |
| 71 | } |
| 72 | |
| 73 | getValue (sep=this.props.sep, data=this.state.data) { |
| 74 | let value = [], |
no test coverage detected