Skip to content

Commit

Permalink
Merge branch 'formily_next' of github.com:alibaba/formily into formil…
Browse files Browse the repository at this point in the history
…y_next
  • Loading branch information
janryWang committed Jul 30, 2021
2 parents d04c757 + c0e2c12 commit 1e2df7c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 31 deletions.
8 changes: 4 additions & 4 deletions packages/next/docs/components/FormItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,16 @@ export default () => {
/>

<SchemaField.String
title="The default is not full (fullness=false)"
title="The default is fullness(fullness=true)"
x-decorator="FormItem"
x-component="Select"
/>
<SchemaField.String
title="Fullness(fullness=true)"
title="Not fullness(fullness=false)"
x-decorator="FormItem"
x-component="Select"
x-decorator-props={{
fullness: true,
fullness: false,
}}
/>

Expand Down Expand Up @@ -1059,7 +1059,7 @@ export default () => {
| wrapperCol | number | The number of columns occupied by the content grid, and the number of label columns add up to 24 | - |
| wrapperAlign | `"left"` \| `"right"` | Content text alignment ⻬ | `"left"` |
| wrapperWrap | boolean | Change the content, otherwise an ellipsis appears, and hover has tooltip | false |
| fullness | boolean | fullness | false |
| fullness | boolean | fullness | true |
| addonBefore | ReactNode | Prefix content | - |
| addonAfter | ReactNode | Suffix content | - |
| size | `"small"` \| `"default"` \| `"large"` | 尺⼨ | - |
Expand Down
8 changes: 4 additions & 4 deletions packages/next/docs/components/FormItem.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,16 @@ export default () => {
/>

<SchemaField.String
title="默认不撑满(fullness=false)"
title="默认撑满(fullness=true)"
x-decorator="FormItem"
x-component="Select"
/>
<SchemaField.String
title="撑满(fullness=true)"
title="不撑满(fullness=false)"
x-decorator="FormItem"
x-component="Select"
x-decorator-props={{
fullness: true,
fullness: false,
}}
/>

Expand Down Expand Up @@ -1059,7 +1059,7 @@ export default () => {
| wrapperCol | number | 内容⽹格所占列数,和标签列数加起来总和为 24 | - |
| wrapperAlign | `"left"` \| `"right"` | 内容文本对齐方式⻬ | `"left"` |
| wrapperWrap | boolean | 内容换⾏,否则出现省略号,hover 有 tooltip | false |
| fullness | boolean | 内容撑满 | false |
| fullness | boolean | 内容撑满 | true |
| addonBefore | ReactNode | 前缀内容 | - |
| addonAfter | ReactNode | 后缀内容 | - |
| size | `"small"` \| `"default"` \| `"large"` | 尺⼨ | - |
Expand Down
4 changes: 4 additions & 0 deletions packages/next/src/form-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ export const FormItem: ComposeFormItem = connect(
)
)

FormItem.defaultProps = {
fullness: true,
}

FormItem.BaseItem = BaseItem

export default FormItem
51 changes: 28 additions & 23 deletions packages/next/src/form-item/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@

&-control-content-component {
line-height: $form-element-medium-height;

& > .#{$css-prefix}input,
.#{$css-prefix}select,
.#{$css-prefix}date-picker,
.#{$css-prefix}number-picker {
width: 100% !important;
}
}

&-inset {
padding: 0 8px;
border-radius: $form-element-large-corner;
border-radius: $form-element-medium-corner;
width: 100%;

.#{$css-prefix}input {
Expand Down Expand Up @@ -172,6 +165,7 @@

.#{$form-item-cls}-size-small {
font-size: $form-element-small-font-size;
line-height: $form-element-small-height;

.#{$form-item-cls}-label-content {
min-height: $form-element-small-height;
Expand All @@ -182,6 +176,18 @@
line-height: $form-element-small-height;
min-height: $form-element-small-height;
}

.#{$form-item-cls}-addon-before {
min-height: $form-element-small-height;
}

.#{$form-item-cls}-addon-after {
min-height: $form-element-small-height;
}
}

&-inset {
border-radius: $form-element-small-corner;
}

&.#{$form-item-cls}-feedback-layout-terse {
Expand Down Expand Up @@ -216,6 +222,7 @@

.#{$form-item-cls}-size-large {
font-size: $form-element-large-font-size;
line-height: $form-element-large-height;

.#{$form-item-cls}-label-content {
min-height: $form-element-large-height;
Expand All @@ -226,17 +233,25 @@
line-height: $form-element-large-height;
min-height: $form-element-large-height;
}

.#{$form-item-cls}-addon-before {
min-height: $form-element-large-height;
}

.#{$form-item-cls}-addon-after {
min-height: $form-element-large-height;
}
}

&-inset {
border-radius: $form-element-large-corner;
}

.#{$form-item-cls}-help,
.#{$form-item-cls}-extra {
min-height: $form-element-large-font-size + 2;
}

.#{$form-item-cls}-control-content {
min-height: $form-element-large-height;
}

&.#{$form-item-cls}-feedback-layout-loose {
margin-bottom: $form-item-l-margin-b;

Expand All @@ -254,16 +269,6 @@
}
}

.#{$form-item-cls} {
&-layout-vertical {
display: block;

.#{$form-item-cls}-label-content {
min-height: $form-element-medium-height - 10 !important;
}
}
}

.#{$form-item-cls}-feedback-layout-popover {
margin-bottom: 8px;
}
Expand Down Expand Up @@ -319,7 +324,7 @@
> .#{$form-item-cls}-control {
> .#{$form-item-cls}-control-content {
> .#{$form-item-cls}-control-content-component {
> *:first-child {
> *:first-child:not(.#{$css-prefix}switch) {
width: 100%;
}
}
Expand Down

0 comments on commit 1e2df7c

Please sign in to comment.