Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize Input Component of AutoComplete #4483

Merged
merged 6 commits into from
Jan 13, 2017

Conversation

RaoHai
Copy link
Contributor

@RaoHai RaoHai commented Jan 5, 2017

close: #4082

  • usage:
    <AutoComplete>
      <textarea onKeyDown={someKeyDownCallback} />
    </AutoComplete>

@mention-bot
Copy link

@RaoHai, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjycui, @yesmeck and @yiminghe to be potential reviewers.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 71.498% when pulling 6a3c9f66ce5c3c33b3c5239e583eba9d8c558666 on RaoHai:newAutoComplete into e54da6e on ant-design:feature-2.7.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 71.498% when pulling 9bb86c33cccd596ade2d8e891641a98c349afd2a on RaoHai:newAutoComplete into e54da6e on ant-design:feature-2.7.

@@ -56,7 +56,7 @@
"rc-progress": "~2.0.1",
"rc-radio": "~2.0.0",
"rc-rate": "~1.1.2",
"rc-select": "~6.6.1",
"rc-select": "^6.7.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ => ~

@autocomplete-prefix-cls: ~"@{select-prefix-cls}-auto-complete";

.@{autocomplete-prefix-cls} {
&.@{select-prefix-cls} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缩进不对。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没看出来。。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看错了。。

@coveralls
Copy link

Coverage Status

Coverage remained the same at 71.498% when pulling ecacacbcc2695f9db978e9c0ea90c9130b17e550 on RaoHai:newAutoComplete into e54da6e on ant-design:feature-2.7.

@RaoHai
Copy link
Contributor Author

RaoHai commented Jan 5, 2017

补一下 React.Children.only, 免得传多个 children。。。

@coveralls
Copy link

Coverage Status

Coverage remained the same at 71.498% when pulling ecacacbcc2695f9db978e9c0ea90c9130b17e550 on RaoHai:newAutoComplete into e54da6e on ant-design:feature-2.7.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 71.498% when pulling c951191ac1449eff739f224e406ae7ef32a4f94a on RaoHai:newAutoComplete into e54da6e on ant-design:feature-2.7.

>
{children}
</AutoComplete>
dataSource={children}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!!!

没理解错的话,breaking changes?

可以做下兼容么。。如果 children 是一个数组,且为 AutoComplete.Option 则用回之前的逻辑。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以。。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实不一定是数组。。

<AutoComplete>
  <Option />
</AutoComplete>

onChange={this.handleChange}
placeholder="input here"
>
<textarea onKeyPress={this.handleKeyPress} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

被包裹的元素有什么要求,最好文档解释一下。

@coveralls
Copy link

Coverage Status

Coverage remained the same at 71.498% when pulling 805e4857d1113d7597a0ba14f45545c823668704 on RaoHai:newAutoComplete into e54da6e on ant-design:feature-2.7.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 71.498% when pulling 9e29923547a4a274f58f7cb250503241a2a24d23 on RaoHai:newAutoComplete into e54da6e on ant-design:feature-2.7.

@yesmeck
Copy link
Member

yesmeck commented Jan 9, 2017

这个怎么带了其他人的 commit?

@RaoHai
Copy link
Contributor Author

RaoHai commented Jan 9, 2017

不知道啊,我 rebase 一下,,,

Copy link
Member

@yesmeck yesmeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个可以写下测试,input 是自定义的情况。

value: any;
}

export type InvalidInputElement =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是 Valid?

@@ -145,17 +145,14 @@
"demolint": "RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
"lesshint": "lesshint components -r scripts/lesshint-report.js",
"eslint-fix": "eslint --fix tests site scripts components ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx' --ignore-pattern '!.eslintrc.js' && eslint-tinker ./components/*/demo/*.md",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空行是特意保留的

@RaoHai RaoHai force-pushed the newAutoComplete branch 6 times, most recently from a289166 to cf604ef Compare January 9, 2017 06:33
@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.305% when pulling cf604ef942009c9f8dd09e9fddce22813dc2bc32 on RaoHai:newAutoComplete into b5d0ace on ant-design:feature-2.7.

@@ -26,6 +38,25 @@ export interface AutoCompleteProps {
allowClear?: boolean;
onChange?: (value: string | Array<any> | SelectedValue | Array<SelectedValue>) => void;
disabled?: boolean;
children: ValidInputElement |
React.ClassicComponentClass<OptionProps> |
Array<React.ClassicComponentClass<OptionProps>>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不对吧,<Option /> 也是 ReactElementOption 才是 React.ClassicComponentClass<OptionProps>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实。。。

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 76.867% when pulling 105d2d4622f1a8c207d677a8c7add93e3d4a2803 on RaoHai:newAutoComplete into b5d0ace on ant-design:feature-2.7.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.867% when pulling 486d1a524bc6e4dad6d2fbe09a49ef30f492dfdb on RaoHai:newAutoComplete into f436b5c on ant-design:feature-2.7.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.701% when pulling b52193c on RaoHai:newAutoComplete into 3fa5d10 on ant-design:feature-2.7.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.701% when pulling b52193c on RaoHai:newAutoComplete into 3fa5d10 on ant-design:feature-2.7.

@@ -29,3 +29,5 @@ Since `AutoComplete` is based on `Select`, so besides the following API, `AutoCo
| onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - |
| disabled | Whether disabled select | boolean | false |
| placeholder | placeholder of input | string | - |
| children (for dataSource) | Data source for autocomplet | React.ClassicComponentClass<OptionProps> / Array<React.ClassicComponentClass<OptionProps>> | - |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React.ClassicComponentClass<OptionProps> 这里也要改掉。

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 76.274% when pulling 5a5bab2 on RaoHai:newAutoComplete into 3fa5d10 on ant-design:feature-2.7.

@afc163 afc163 merged commit 46c2008 into ant-design:feature-2.7 Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants