From 169e0f97626fd775dd8cfba12f9918ae12d13235 Mon Sep 17 00:00:00 2001 From: kossel Date: Fri, 5 May 2017 01:40:57 -0500 Subject: [PATCH] fix: issue 5834, autocomplete is not being decorated (#6018) --- components/auto-complete/style/index.less | 3 +- components/form/demo/register.md | 38 ++++++++++++++++++++++- components/select/style/index.less | 2 +- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/components/auto-complete/style/index.less b/components/auto-complete/style/index.less index ac083617a2..56fa7f0303 100644 --- a/components/auto-complete/style/index.less +++ b/components/auto-complete/style/index.less @@ -31,7 +31,6 @@ } .@{input-prefix-cls} { - .input(); background: transparent; } @@ -54,7 +53,7 @@ } .@{input-prefix-cls} { - border: @border-width-base @border-style-base @border-color-base; + border-width: @border-width-base; &:focus, &:hover { .hover; diff --git a/components/form/demo/register.md b/components/form/demo/register.md index cf911ef9c3..c63de781ab 100644 --- a/components/form/demo/register.md +++ b/components/form/demo/register.md @@ -14,9 +14,10 @@ title: Fill in this form to create a new account for you. ````jsx -import { Form, Input, Tooltip, Icon, Cascader, Select, Row, Col, Checkbox, Button } from 'antd'; +import { Form, Input, Tooltip, Icon, Cascader, Select, Row, Col, Checkbox, Button, AutoComplete } from 'antd'; const FormItem = Form.Item; const Option = Select.Option; +const AutoCompleteOption = AutoComplete.Option; const residences = [{ value: 'zhejiang', @@ -45,6 +46,7 @@ const residences = [{ class RegistrationForm extends React.Component { state = { confirmDirty: false, + autoCompleteResult: [], }; handleSubmit = (e) => { e.preventDefault(); @@ -73,8 +75,21 @@ class RegistrationForm extends React.Component { } callback(); } + + handleWebsiteChange = (value) => { + let autoCompleteResult; + if (!value) { + autoCompleteResult = []; + } else { + autoCompleteResult = ['.com', '.org', '.net'].map(domain => `${value}${domain}`); + } + this.setState({ autoCompleteResult }); + } + render() { const { getFieldDecorator } = this.props.form; + const { autoCompleteResult } = this.state; + const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -104,6 +119,11 @@ class RegistrationForm extends React.Component { ); + + const websiteOptions = autoCompleteResult.map((website) => { + return {website}; + }); + return (
)} + + {getFieldDecorator('website', { + rules: [{ required: true, message: 'Please input website!' }], + })( + + + + )} +