Commit 695dd1fe by Vladislav Lagunov

[Suggestions] Исправлено позиционирование попапов

parent 2db2033b
...@@ -210,14 +210,12 @@ export default class AutoComplete<A=string> extends React.Component<Props<A> & { ...@@ -210,14 +210,12 @@ export default class AutoComplete<A=string> extends React.Component<Props<A> & {
renderSeeMoreLink() { renderSeeMoreLink() {
const { __, classes } = this.props; const { __, classes } = this.props;
const { total, query: { limit, offset } } = this.state; const { total, query: { limit, offset } } = this.state;
if (total !== 0 && limit + offset >= total) return null; if (total !== 0 && limit + offset >= total) return null;
return <ListItem className={classes!.seeMore}> return <ListItem className={classes!.seeMore}>
<a href="javascript://void 0" onMouseDown={this.handleSeeMore}>{__('See more')}</a> <a href="javascript://void 0" onMouseDown={this.handleSeeMore}>{__('See more')}</a>
</ListItem>; </ListItem>;
} }
render() { render() {
const { className, fullWidth, children, ctx, source, debounce, renderItem, printItem, openOnFocus, openOnClick, suggestionProps, keepOpenAfterSelect, textFieldProps, classes, anchorEl, observable, ...rest } = this.props; const { className, fullWidth, children, ctx, source, debounce, renderItem, printItem, openOnFocus, openOnClick, suggestionProps, keepOpenAfterSelect, textFieldProps, classes, anchorEl, observable, ...rest } = this.props;
const { suggestions, open, pending } = this.state; const { suggestions, open, pending } = this.state;
...@@ -225,7 +223,6 @@ export default class AutoComplete<A=string> extends React.Component<Props<A> & { ...@@ -225,7 +223,6 @@ export default class AutoComplete<A=string> extends React.Component<Props<A> & {
[classes!.fullWidth!]: fullWidth [classes!.fullWidth!]: fullWidth
}); });
return <div {...rest} className={rootClass}> return <div {...rest} className={rootClass}>
{!observable && (children ? React.cloneElement(children, this.childrenProps()) : <TextField {...this.childrenProps() as any} {...textFieldProps}/>)} {!observable && (children ? React.cloneElement(children, this.childrenProps()) : <TextField {...this.childrenProps() as any} {...textFieldProps}/>)}
<Suggestions <Suggestions
......
...@@ -161,9 +161,10 @@ class Suggestions<A> extends React.Component<Props<A>, State> { ...@@ -161,9 +161,10 @@ class Suggestions<A> extends React.Component<Props<A>, State> {
let top = anchorRect.bottom + 4; let top = anchorRect.bottom + 4;
const bottom = top + rectHeight const bottom = top + rectHeight
if (bottom > heightThreshold && anchorRect.top - window.scrollY - rectHeight - 8 > marginThreshold) { if (bottom > heightThreshold && anchorRect.top - window.scrollY - rectHeight - 8 > marginThreshold) {
top = anchorRect.top - 8 - rectHeight; this.paperEl.style.bottom = - (anchorRect.top - 8) + 'px';
} } else {
this.paperEl.style.top = top + 'px'; this.paperEl.style.top = top + 'px';
}
this.paperEl.style.left = anchorRect.left + 'px'; this.paperEl.style.left = anchorRect.left + 'px';
this.paperEl.style.minWidth = anchorRect.width + 'px'; this.paperEl.style.minWidth = anchorRect.width + 'px';
}; };
......
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