💄 Fix extra margin of nested form item

close #13748
This commit is contained in:
afc163 2018-12-22 16:44:10 +08:00
parent a7597819a2
commit d78d0de36c
No known key found for this signature in database
GPG Key ID: 5F00908D72002306
3 changed files with 88 additions and 104 deletions

View File

@ -4328,6 +4328,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
</div> </div>
<div <div
class="ant-row ant-form-item" class="ant-row ant-form-item"
style="margin-bottom:0"
> >
<div <div
class="ant-form-item-label ant-col-xs-24 ant-col-sm-5" class="ant-form-item-label ant-col-xs-24 ant-col-sm-5"
@ -4349,114 +4350,104 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class="ant-form-item-children" class="ant-form-item-children"
> >
<div <div
class="ant-col-11" class="ant-row ant-form-item ant-form-item-with-help"
style="display:inline-block;width:calc(50% - 12px)"
> >
<div <div
class="ant-row ant-form-item ant-form-item-with-help" class="ant-form-item-control-wrapper"
> >
<div <div
class="ant-form-item-control-wrapper" class="ant-form-item-control has-error"
> >
<div <span
class="ant-form-item-control has-error" class="ant-form-item-children"
> >
<span <span
class="ant-form-item-children" class="ant-calendar-picker"
> >
<span <div>
class="ant-calendar-picker" <input
> class="ant-calendar-picker-input ant-input"
<div> placeholder="Select date"
<input readonly=""
class="ant-calendar-picker-input ant-input" value=""
placeholder="Select date" />
readonly="" <i
value="" class="anticon anticon-calendar ant-calendar-picker-icon"
/> >
<i <svg
class="anticon anticon-calendar ant-calendar-picker-icon" aria-hidden="true"
class=""
data-icon="calendar"
fill="currentColor"
height="1em"
viewBox="64 64 896 896"
width="1em"
> >
<svg <path
aria-hidden="true" d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
class="" />
data-icon="calendar" </svg>
fill="currentColor" </i>
height="1em" </div>
viewBox="64 64 896 896"
width="1em"
>
<path
d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
/>
</svg>
</i>
</div>
</span>
</span> </span>
<div </span>
class="ant-form-explain" <div
> class="ant-form-explain"
Please select the correct date >
</div> Please select the correct date
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div <span
class="ant-col-2" style="display:inline-block;width:24px;text-align:center"
> >
<span -
style="display:inline-block;width:100%;text-align:center" </span>
>
-
</span>
</div>
<div <div
class="ant-col-11" class="ant-row ant-form-item"
style="display:inline-block;width:calc(50% - 12px)"
> >
<div <div
class="ant-row ant-form-item" class="ant-form-item-control-wrapper"
> >
<div <div
class="ant-form-item-control-wrapper" class="ant-form-item-control"
> >
<div <span
class="ant-form-item-control" class="ant-form-item-children"
> >
<span <span
class="ant-form-item-children" class="ant-calendar-picker"
> >
<span <div>
class="ant-calendar-picker" <input
> class="ant-calendar-picker-input ant-input"
<div> placeholder="Select date"
<input readonly=""
class="ant-calendar-picker-input ant-input" value=""
placeholder="Select date" />
readonly="" <i
value="" class="anticon anticon-calendar ant-calendar-picker-icon"
/> >
<i <svg
class="anticon anticon-calendar ant-calendar-picker-icon" aria-hidden="true"
class=""
data-icon="calendar"
fill="currentColor"
height="1em"
viewBox="64 64 896 896"
width="1em"
> >
<svg <path
aria-hidden="true" d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
class="" />
data-icon="calendar" </svg>
fill="currentColor" </i>
height="1em" </div>
viewBox="64 64 896 896"
width="1em"
>
<path
d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"
/>
</svg>
</i>
</div>
</span>
</span> </span>
</div> </span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -23,7 +23,7 @@ We provide properties like `validateStatus` `help` `hasFeedback` to customize yo
````jsx ````jsx
import { import {
Form, Input, DatePicker, Col, TimePicker, Select, Cascader, InputNumber, Form, Input, DatePicker, TimePicker, Select, Cascader, InputNumber,
} from 'antd'; } from 'antd';
const FormItem = Form.Item; const FormItem = Form.Item;
@ -141,22 +141,21 @@ ReactDOM.render(
<FormItem <FormItem
label="inline" label="inline"
{...formItemLayout} {...formItemLayout}
style={{ marginBottom: 0 }}
> >
<Col span={11}> <FormItem
<FormItem validateStatus="error" help="Please select the correct date"> validateStatus="error"
<DatePicker /> help="Please select the correct date"
</FormItem> style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}
</Col> >
<Col span={2}> <DatePicker />
<span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}> </FormItem>
- <span style={{ display: 'inline-block', width: '24px', textAlign: 'center' }}>
</span> -
</Col> </span>
<Col span={11}> <FormItem style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}>
<FormItem> <DatePicker />
<DatePicker /> </FormItem>
</FormItem>
</Col>
</FormItem> </FormItem>
<FormItem <FormItem

View File

@ -74,12 +74,6 @@ input[type='checkbox'] {
margin-bottom: @form-item-margin-bottom; margin-bottom: @form-item-margin-bottom;
vertical-align: top; vertical-align: top;
// nested FormItem
&-control > &:last-child,
& [class^='@{ant-prefix}-col-'] > &:only-child {
margin-bottom: -@form-item-margin-bottom;
}
&-control { &-control {
line-height: @form-component-max-height - 0.0001px; // https://github.com/ant-design/ant-design/issues/8220 line-height: @form-component-max-height - 0.0001px; // https://github.com/ant-design/ant-design/issues/8220
position: relative; position: relative;