Commit aa441891 by Vladislav Lagunov

Улучшено поведение кнопки для закрытия автокомплита

parent c3f4515c
......@@ -128,6 +128,12 @@ export default class AutoComplete<A=string> extends React.Component<Props<A>, St
else this.dispatch({ tag: 'Open' });
};
handleCloseClick = (e: React.MouseEvent) => {
e.stopPropagation();
this.setState({ value: null });
!this.props.nonNull && this.handleSuggestionSelect('null' in this.props ? this.props.null : null);
};
getValue = () => {
const { printItem } = this.props;
if (this.state.value !== null) return this.state.value;
......@@ -160,7 +166,7 @@ export default class AutoComplete<A=string> extends React.Component<Props<A>, St
endAdornment = memoize((nonNull: boolean, disabled: boolean) => <React.Fragment>
<Icon onClick={disabled ? undefined : this.handleToggleVisibility}>arrow_drop_down</Icon>
{!nonNull && <Icon onClick={disabled ? undefined : (() => this.handleValueChange(''))}>close</Icon>}
{!nonNull && <Icon onClick={disabled ? undefined : this.handleCloseClick}>close</Icon>}
</React.Fragment>);
childrenProps = () => {
......
import * as React from 'react';
import { CrudResource } from '~/utils/jsonapi';
import { CrudResource } from '~/jsonapi';
import { AuthCtx as Ctx } from '~/utils';
import { Eff } from '@bitmaster/core';
import * as Rx from 'rxjs';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment