|
|
@ -113,10 +113,12 @@ class EnhancedSelectInput extends Component {
|
|
|
|
this._scheduleUpdate();
|
|
|
|
this._scheduleUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!Array.isArray(this.props.value) && prevProps.value !== this.props.value) {
|
|
|
|
if (!Array.isArray(this.props.value)) {
|
|
|
|
this.setState({
|
|
|
|
if (prevProps.value !== this.props.value || prevProps.values !== this.props.values) {
|
|
|
|
selectedIndex: getSelectedIndex(this.props)
|
|
|
|
this.setState({
|
|
|
|
});
|
|
|
|
selectedIndex: getSelectedIndex(this.props)
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -332,6 +334,11 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
const isMultiSelect = Array.isArray(value);
|
|
|
|
const isMultiSelect = Array.isArray(value);
|
|
|
|
const selectedOption = getSelectedOption(selectedIndex, values);
|
|
|
|
const selectedOption = getSelectedOption(selectedIndex, values);
|
|
|
|
|
|
|
|
let selectedValue = value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!values.length) {
|
|
|
|
|
|
|
|
selectedValue = isMultiSelect ? [] : '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
@ -372,15 +379,17 @@ class EnhancedSelectInput extends Component {
|
|
|
|
onPress={this.onPress}
|
|
|
|
onPress={this.onPress}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
isFetching &&
|
|
|
|
isFetching ?
|
|
|
|
<LoadingIndicator
|
|
|
|
<LoadingIndicator
|
|
|
|
className={styles.loading}
|
|
|
|
className={styles.loading}
|
|
|
|
size={20}
|
|
|
|
size={20}
|
|
|
|
/>
|
|
|
|
/> :
|
|
|
|
|
|
|
|
null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
!isFetching &&
|
|
|
|
isFetching ?
|
|
|
|
|
|
|
|
null :
|
|
|
|
<Icon
|
|
|
|
<Icon
|
|
|
|
name={icons.CARET_DOWN}
|
|
|
|
name={icons.CARET_DOWN}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -400,7 +409,7 @@ class EnhancedSelectInput extends Component {
|
|
|
|
onPress={this.onPress}
|
|
|
|
onPress={this.onPress}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<SelectedValueComponent
|
|
|
|
<SelectedValueComponent
|
|
|
|
value={value}
|
|
|
|
value={selectedValue}
|
|
|
|
values={values}
|
|
|
|
values={values}
|
|
|
|
{...selectedValueOptions}
|
|
|
|
{...selectedValueOptions}
|
|
|
|
{...selectedOption}
|
|
|
|
{...selectedOption}
|
|
|
@ -418,15 +427,17 @@ class EnhancedSelectInput extends Component {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
isFetching &&
|
|
|
|
isFetching ?
|
|
|
|
<LoadingIndicator
|
|
|
|
<LoadingIndicator
|
|
|
|
className={styles.loading}
|
|
|
|
className={styles.loading}
|
|
|
|
size={20}
|
|
|
|
size={20}
|
|
|
|
/>
|
|
|
|
/> :
|
|
|
|
|
|
|
|
null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
!isFetching &&
|
|
|
|
isFetching ?
|
|
|
|
|
|
|
|
null :
|
|
|
|
<Icon
|
|
|
|
<Icon
|
|
|
|
name={icons.CARET_DOWN}
|
|
|
|
name={icons.CARET_DOWN}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -505,7 +516,7 @@ class EnhancedSelectInput extends Component {
|
|
|
|
</Manager>
|
|
|
|
</Manager>
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
isMobile &&
|
|
|
|
isMobile ?
|
|
|
|
<Modal
|
|
|
|
<Modal
|
|
|
|
className={styles.optionsModal}
|
|
|
|
className={styles.optionsModal}
|
|
|
|
size={sizes.EXTRA_SMALL}
|
|
|
|
size={sizes.EXTRA_SMALL}
|
|
|
@ -555,7 +566,8 @@ class EnhancedSelectInput extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</Scroller>
|
|
|
|
</Scroller>
|
|
|
|
</ModalBody>
|
|
|
|
</ModalBody>
|
|
|
|
</Modal>
|
|
|
|
</Modal> :
|
|
|
|
|
|
|
|
null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|