Skip to content

Commit

Permalink
docs: Document AutoComplete[onSearch]
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck authored and ddcat1115 committed Apr 22, 2017
1 parent b5c5466 commit 07072fc
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions components/auto-complete/demo/antd.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Complete extends React.Component {
dataSource: [],
}

handleChange = (value) => {
handleSearch = (value) => {
this.setState({
dataSource: !value ? [] : [
value,
Expand All @@ -46,7 +46,7 @@ class Complete extends React.Component {
dataSource={dataSource}
style={{ width: 200, height: 50 }}
onSelect={onSelect}
onChange={this.handleChange}
onSearch={this.handleSearch}
placeholder="input here"
>
<textarea onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
Expand Down
4 changes: 2 additions & 2 deletions components/auto-complete/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Complete extends React.Component {
dataSource: [],
}

handleChange = (value) => {
handleSearch = (value) => {
this.setState({
dataSource: !value ? [] : [
value,
Expand All @@ -42,7 +42,7 @@ class Complete extends React.Component {
dataSource={dataSource}
style={{ width: 200 }}
onSelect={onSelect}
onChange={this.handleChange}
onSearch={this.handleSearch}
placeholder="input here"
/>
);
Expand Down
4 changes: 2 additions & 2 deletions components/auto-complete/demo/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Complete extends React.Component {
result: [],
}

handleChange = (value) => {
handleSearch = (value) => {
let result;
if (!value || value.indexOf('@') >= 0) {
result = [];
Expand All @@ -41,7 +41,7 @@ class Complete extends React.Component {
return (
<AutoComplete
style={{ width: 200 }}
onChange={this.handleChange}
onSearch={this.handleSearch}
placeholder="input here"
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions components/auto-complete/demo/uncertain-category.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Complete extends React.Component {
dataSource: [],
}

handleChange = (value) => {
handleSearch = (value) => {
this.setState({
dataSource: value ? searchResult(value) : [],
});
Expand All @@ -73,7 +73,7 @@ class Complete extends React.Component {
style={{ width: '100%' }}
dataSource={dataSource.map(renderOption)}
onSelect={onSelect}
onChange={this.handleChange}
onSearch={this.handleSearch}
placeholder="input here"
optionLabelProp="text"
>
Expand Down
1 change: 1 addition & 0 deletions components/auto-complete/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const dataSource = ['12345', '23456', '34567'];
| allowClear | Show clear button, effective in multiple mode only. | boolean | false |
| onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - |
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
| onSearch | Called when searching items. | function(value) | - |
| disabled | Whether disabled select | boolean | false |
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
| placeholder | placeholder of input | string | - |
Expand Down
1 change: 1 addition & 0 deletions components/auto-complete/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const dataSource = ['12345', '23456', '34567'];
| allowClear | 支持清除, 单选模式有效 | boolean | false |
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) ||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) ||
| onSearch | 搜索补全项的时候调用 | function(value) ||
| disabled | 是否禁用 | boolean | false |
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
| placeholder | 输入框提示 | string | - |
Expand Down

0 comments on commit 07072fc

Please sign in to comment.