Skip to content

Commit

Permalink
feat(antd/next): support inherit mode to FormItem
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jun 21, 2021
1 parent 45e9e7f commit da7423d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
34 changes: 17 additions & 17 deletions packages/antd/src/form-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@ const useFormItemLayout = (props: IFormItemProps) => {
const layout = useFormLayout()
return {
...props,
layout: props.layout ?? layout.layout ?? 'horizontal',
colon: props.colon ?? layout.colon,
layout: props.layout || layout.layout || 'horizontal',
colon: props.colon || layout.colon,
labelAlign:
layout.layout === 'vertical'
? props.labelAlign ?? layout.labelAlign ?? 'left'
: props.labelAlign ?? layout.labelAlign ?? 'right',
labelWrap: props.labelWrap ?? layout.labelWrap,
labelWidth: props.labelWidth ?? layout.labelWidth,
wrapperWidth: props.wrapperWidth ?? layout.wrapperWidth,
labelCol: props.labelCol ?? layout.labelCol,
wrapperCol: props.wrapperCol ?? layout.wrapperCol,
wrapperAlign: props.wrapperAlign ?? layout.wrapperAlign,
wrapperWrap: props.wrapperWrap ?? layout.wrapperWrap,
fullness: props.fullness ?? layout.fullness,
size: props.size ?? layout.size,
inset: props.inset ?? layout.inset,
? props.labelAlign || layout.labelAlign || 'left'
: props.labelAlign || layout.labelAlign || 'right',
labelWrap: props.labelWrap || layout.labelWrap,
labelWidth: props.labelWidth || layout.labelWidth,
wrapperWidth: props.wrapperWidth || layout.wrapperWidth,
labelCol: props.labelCol || layout.labelCol,
wrapperCol: props.wrapperCol || layout.wrapperCol,
wrapperAlign: props.wrapperAlign || layout.wrapperAlign,
wrapperWrap: props.wrapperWrap || layout.wrapperWrap,
fullness: props.fullness || layout.fullness,
size: props.size || layout.size,
inset: props.inset || layout.inset,
asterisk: props.asterisk,
bordered: props.bordered ?? layout.bordered,
bordered: props.bordered || layout.bordered,
feedbackIcon: props.feedbackIcon,
feedbackLayout: props.feedbackLayout ?? layout.feedbackLayout ?? 'loose',
tooltipLayout: props.tooltipLayout ?? layout.tooltipLayout ?? 'icon',
feedbackLayout: props.feedbackLayout || layout.feedbackLayout || 'loose',
tooltipLayout: props.tooltipLayout || layout.tooltipLayout || 'icon',
}
}

Expand Down
34 changes: 17 additions & 17 deletions packages/next/src/form-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@ const useFormItemLayout = (props: IFormItemProps) => {
const layout = useFormLayout()
return {
...props,
layout: props.layout ?? layout.layout ?? 'horizontal',
colon: props.colon ?? layout.colon,
layout: props.layout || layout.layout || 'horizontal',
colon: props.colon || layout.colon,
labelAlign:
layout.layout === 'vertical'
? props.labelAlign ?? layout.labelAlign ?? 'left'
: props.labelAlign ?? layout.labelAlign ?? 'right',
labelWrap: props.labelWrap ?? layout.labelWrap,
labelWidth: props.labelWidth ?? layout.labelWidth,
wrapperWidth: props.wrapperWidth ?? layout.wrapperWidth,
labelCol: props.labelCol ?? layout.labelCol,
wrapperCol: props.wrapperCol ?? layout.wrapperCol,
wrapperAlign: props.wrapperAlign ?? layout.wrapperAlign,
wrapperWrap: props.wrapperWrap ?? layout.wrapperWrap,
fullness: props.fullness ?? layout.fullness,
size: props.size ?? layout.size,
inset: props.inset ?? layout.inset,
? props.labelAlign || layout.labelAlign || 'left'
: props.labelAlign || layout.labelAlign || 'right',
labelWrap: props.labelWrap || layout.labelWrap,
labelWidth: props.labelWidth || layout.labelWidth,
wrapperWidth: props.wrapperWidth || layout.wrapperWidth,
labelCol: props.labelCol || layout.labelCol,
wrapperCol: props.wrapperCol || layout.wrapperCol,
wrapperAlign: props.wrapperAlign || layout.wrapperAlign,
wrapperWrap: props.wrapperWrap || layout.wrapperWrap,
fullness: props.fullness || layout.fullness,
size: props.size || layout.size,
inset: props.inset || layout.inset,
asterisk: props.asterisk,
bordered: props.bordered ?? layout.bordered,
bordered: props.bordered || layout.bordered,
feedbackIcon: props.feedbackIcon,
feedbackLayout: props.feedbackLayout ?? layout.feedbackLayout ?? 'loose',
tooltipLayout: props.tooltipLayout ?? layout.tooltipLayout ?? 'icon',
feedbackLayout: props.feedbackLayout || layout.feedbackLayout || 'loose',
tooltipLayout: props.tooltipLayout || layout.tooltipLayout || 'icon',
}
}

Expand Down

0 comments on commit da7423d

Please sign in to comment.