react-select
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -109,3 +109,3 @@ 'use strict'; | ||
defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : undefined, | ||
inputValue: '', | ||
inputValue: props.inputValue, | ||
isLoading: props.defaultOptions === true ? true : false, | ||
@@ -125,5 +125,6 @@ loadedOptions: [], | ||
var defaultOptions = this.props.defaultOptions; | ||
var inputValue = this.state.inputValue; | ||
if (defaultOptions === true) { | ||
this.loadOptions('', function (options) { | ||
this.loadOptions(inputValue, function (options) { | ||
if (!_this2.mounted) return; | ||
@@ -130,0 +131,0 @@ var isLoading = !!_this2.lastRequest; |
@@ -763,2 +763,3 @@ 'use strict'; | ||
readOnly: true, | ||
disabled: isDisabled, | ||
tabIndex: tabIndex, | ||
@@ -822,3 +823,4 @@ value: '' | ||
selectValue = _state6.selectValue, | ||
focusedValue = _state6.focusedValue; | ||
focusedValue = _state6.focusedValue, | ||
isFocused = _state6.isFocused; | ||
@@ -829,3 +831,7 @@ | ||
Placeholder, | ||
_extends({}, commonProps, { key: 'placeholder', isDisabled: isDisabled }), | ||
_extends({}, commonProps, { | ||
key: 'placeholder', | ||
isDisabled: isDisabled, | ||
isFocused: isFocused | ||
}), | ||
placeholder | ||
@@ -1493,3 +1499,6 @@ ); | ||
} else { | ||
_this7.onMenuClose(); | ||
// $FlowFixMe HTMLElement type does not have tagName property | ||
if (event.target.tagName !== 'INPUT') { | ||
_this7.onMenuClose(); | ||
} | ||
} | ||
@@ -1644,2 +1653,6 @@ // $FlowFixMe HTMLElement type does not have tagName property | ||
this.onInputBlur = function (event) { | ||
if (_this7.menuListRef && _this7.menuListRef.contains(document.activeElement)) { | ||
_this7.inputRef.focus(); | ||
return; | ||
} | ||
if (_this7.props.onBlur) { | ||
@@ -1718,3 +1731,7 @@ _this7.props.onBlur(event); | ||
if (!backspaceRemovesValue) return; | ||
_this7.popValue(); | ||
if (isMulti) { | ||
_this7.popValue(); | ||
} else if (isClearable) { | ||
_this7.clearValue(); | ||
} | ||
} | ||
@@ -1721,0 +1738,0 @@ break; |
{ | ||
"name": "react-select", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "A Select control built with and for ReactJS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -50,3 +50,3 @@ // @flow | ||
: undefined, | ||
inputValue: '', | ||
inputValue: props.inputValue, | ||
isLoading: props.defaultOptions === true ? true : false, | ||
@@ -60,4 +60,5 @@ loadedOptions: [], | ||
const { defaultOptions } = this.props; | ||
const { inputValue } = this.state; | ||
if (defaultOptions === true) { | ||
this.loadOptions('', options => { | ||
this.loadOptions(inputValue, options => { | ||
if (!this.mounted) return; | ||
@@ -64,0 +65,0 @@ const isLoading = !!this.lastRequest; |
@@ -36,2 +36,4 @@ // @flow | ||
type: 'option', | ||
/* The data of the selected option. */ | ||
data: any, | ||
}; | ||
@@ -38,0 +40,0 @@ |
@@ -7,3 +7,3 @@ // @flow | ||
type State = { | ||
/** Whether this is disabled */ | ||
/** Whether this is disabled. */ | ||
isDisabled: boolean, | ||
@@ -14,3 +14,3 @@ }; | ||
children: string, | ||
/* The data of the selected option rendered in the Single Value componentn */ | ||
/* The data of the selected option rendered in the Single Value component. */ | ||
data: any, | ||
@@ -17,0 +17,0 @@ /** Props passed to the wrapping element for the group. */ |
@@ -121,3 +121,3 @@ // @flow | ||
instead. For a list of the components that can be passed in, and the shape | ||
that will be passed to them, see [the components docs](/api#components) | ||
that will be passed to them, see [the components docs](/components) | ||
*/ | ||
@@ -133,3 +133,7 @@ components: SelectComponentsConfig, | ||
filterOption: ((Object, string) => boolean) | null, | ||
/* Formats group labels in the menu as React components */ | ||
/* | ||
Formats group labels in the menu as React components | ||
An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation. | ||
*/ | ||
formatGroupLabel: typeof formatGroupLabel, | ||
@@ -158,3 +162,7 @@ /* Formats option labels in the menu and control as React components */ | ||
isLoading: boolean, | ||
/* Override the built-in logic to detect whether an option is disabled */ | ||
/* | ||
Override the built-in logic to detect whether an option is disabled | ||
An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation. | ||
*/ | ||
isOptionDisabled: (OptionType, OptionsType) => boolean | false, | ||
@@ -182,3 +190,7 @@ /* Override the built-in logic to detect whether an option is selected */ | ||
menuPosition: MenuPosition, | ||
/* Whether the menu should use a portal, and where it should attach */ | ||
/* | ||
Whether the menu should use a portal, and where it should attach | ||
An example can be found in the [Portaling](/advanced#portaling) documentation | ||
*/ | ||
menuPortalTarget?: HTMLElement, | ||
@@ -223,3 +235,7 @@ /* Whether to block scroll events when the menu is open */ | ||
screenReaderStatus: ({ count: number }) => string, | ||
/* Style modifier methods */ | ||
/* | ||
Style modifier methods | ||
A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation. | ||
*/ | ||
styles: StylesConfig, | ||
@@ -876,3 +892,6 @@ /* Theme modifier method */ | ||
} else { | ||
this.onMenuClose(); | ||
// $FlowFixMe HTMLElement type does not have tagName property | ||
if (event.target.tagName !== 'INPUT') { | ||
this.onMenuClose(); | ||
} | ||
} | ||
@@ -1052,2 +1071,6 @@ // $FlowFixMe HTMLElement type does not have tagName property | ||
onInputBlur = (event: SyntheticFocusEvent<HTMLInputElement>) => { | ||
if(this.menuListRef && this.menuListRef.contains(document.activeElement)) { | ||
this.inputRef.focus(); | ||
return; | ||
} | ||
if (this.props.onBlur) { | ||
@@ -1126,3 +1149,7 @@ this.props.onBlur(event); | ||
if (!backspaceRemovesValue) return; | ||
this.popValue(); | ||
if (isMulti) { | ||
this.popValue(); | ||
} else if (isClearable) { | ||
this.clearValue(); | ||
} | ||
} | ||
@@ -1349,2 +1376,3 @@ break; | ||
readOnly | ||
disabled={isDisabled} | ||
tabIndex={tabIndex} | ||
@@ -1405,7 +1433,12 @@ value="" | ||
} = this.props; | ||
const { selectValue, focusedValue } = this.state; | ||
const { selectValue, focusedValue, isFocused } = this.state; | ||
if (!this.hasValue() || !controlShouldRenderValue) { | ||
return inputValue ? null : ( | ||
<Placeholder {...commonProps} key="placeholder" isDisabled={isDisabled}> | ||
<Placeholder | ||
{...commonProps} | ||
key="placeholder" | ||
isDisabled={isDisabled} | ||
isFocused={isFocused} | ||
> | ||
{placeholder} | ||
@@ -1412,0 +1445,0 @@ </Placeholder> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1030699
21218