Skip to content

Commit

Permalink
Fix some problems of AutoCompelete demo (ant-design#4942)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaoHai authored and afc163 committed Feb 19, 2017
1 parent b90237e commit 7a4080e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 8 additions & 2 deletions components/auto-complete/demo/uncertain-category.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function renderOption(item) {
{item.category}
</a>
区块中
<span style={{ float: 'right' }}>约 {item.count} 个结果</span>
<span className="global-search-item-count">约 {item.count} 个结果</span>
</Option>
);
}
Expand Down Expand Up @@ -128,11 +128,17 @@ ReactDOM.render(<Complete />, mountNode);
}

.global-search.ant-select-auto-complete .ant-input-preSuffix-wrapper .ant-input-suffix {
right: 0;
right: 1px;
}

.global-search.ant-select-auto-complete .ant-input-preSuffix-wrapper .ant-input-suffix button {
border-radius: 3px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

.global-search-item-count {
position: absolute;
right: 16px;
}
````
2 changes: 1 addition & 1 deletion components/auto-complete/index.en-US.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
category: Components
type: Data Entry
cols: 1
cols: 2
title: AutoComplete
---

Expand Down
9 changes: 5 additions & 4 deletions components/auto-complete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,18 @@ export interface AutoCompleteProps extends AbstractSelectProps {
}

class InputElement extends React.Component<any, any> {
private ele: Element;
private ele: HTMLInputElement;

focus = () => {
(findDOMNode(this.ele) as HTMLInputElement).focus();
this.ele.focus ? this.ele.focus() : (findDOMNode(this.ele) as HTMLInputElement).focus();
}
blur = () => {
(findDOMNode(this.ele) as HTMLInputElement).blur();
this.ele.blur ? this.ele.blur() : (findDOMNode(this.ele) as HTMLInputElement).blur();
}
render() {
return React.cloneElement(this.props.children, {
...this.props,
ref: ele => this.ele = ele,
ref: ele => this.ele = (ele as HTMLInputElement),
}, null);
}
}
Expand Down

0 comments on commit 7a4080e

Please sign in to comment.