Account selector close operations (#4728)

* Close when clicking anywhere on body pane

* Allow click to propagate on address click

* Rename noCopy -> allowAddressClick

* Handle i18n strings in input

* Close on pasted addresses (valid entry)

* allowAddressClick default

* Don't do onClick on AccountCard if text is selected

* Reset filter value on close for address selection

* Better close on click for AccountSelection
This commit is contained in:
Jaco Greeff
2017-03-03 14:38:40 +01:00
committed by GitHub
parent 5559374676
commit 6760ae0e84
4 changed files with 56 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ import { observer } from 'mobx-react';
import TextFieldUnderline from 'material-ui/TextField/TextFieldUnderline';
import apiutil from '~/api/util';
import AccountCard from '~/ui/AccountCard';
import InputAddress from '~/ui/Form/InputAddress';
import Loading from '~/ui/Loading';
@@ -177,6 +178,7 @@ class AddressSelect extends Component {
<Portal
className={ styles.inputContainer }
isChildModal
onClick={ this.handleClose }
onClose={ this.handleClose }
onKeyDown={ this.handleKeyDown }
open={ expanded }
@@ -191,6 +193,7 @@ class AddressSelect extends Component {
className={ styles.input }
placeholder={ ilHint }
onBlur={ this.handleInputBlur }
onClick={ this.stopEvent }
onFocus={ this.handleInputFocus }
onChange={ this.handleChange }
ref={ this.setInputRef }
@@ -345,6 +348,7 @@ class AddressSelect extends Component {
return (
<AccountCard
account={ account }
allowAddressClick
balance={ balance }
className={ styles.account }
key={ `account_${index}` }
@@ -377,6 +381,10 @@ class AddressSelect extends Component {
}
}
stopEvent = (event) => {
event.stopPropagation();
}
handleInputAddresKeydown = (event) => {
const code = keycode(event);
@@ -588,6 +596,7 @@ class AddressSelect extends Component {
}
this.store.resetRegistryValues();
this.store.handleChange('');
this.setState({
expanded: false,
@@ -613,6 +622,10 @@ class AddressSelect extends Component {
focusedItem: null,
inputValue: value
});
if (apiutil.isAddressValid(value)) {
this.handleClick(value);
}
}
}