2 * The HTML structure here is aligned with bootstrap HTML structure for form elements.
3 * In this way we have proper styling and it is aligned with other form elements on screen.
5 * Select and MultiSelect options:
7 * label - the label to be shown which paired with the input
9 * all other "react-select" props - as documented on
10 * http://jedwatson.github.io/react-select/
12 * https://github.com/JedWatson/react-select
14 import React, {Component} from 'react';
15 import Select from 'react-select';
17 class SelectInput extends Component {
22 let {label, value, ...other} = this.props;
24 <div className='validation-input-wrapper dropdown-multi-select'>
25 <div className='form-group'>
26 {label && <label className='control-label'>{label}</label>}
27 <Select ref='_myInput' onChange={value => this.onSelectChanged(value)} {...other} value={value} />
34 return this.inputValue && this.inputValue.length ? this.inputValue : '';
37 onSelectChanged(value) {
38 this.props.onMultiSelectChanged(value);
42 let {value} = this.props;
43 this.inputValue = value ? value : [];
45 componentDidUpdate() {
46 if (this.inputValue !== this.props.value) {
47 this.inputValue = this.props.value;
52 export default SelectInput;