From b5eeb2a361f32f429dd8737a9cd561d936b41bc9 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Wed, 18 Oct 2023 16:57:56 +0800 Subject: [PATCH] =?UTF-8?q?BasicForm=20=E6=94=AF=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E8=A1=8C=E6=98=BE=E7=A4=BA=20(inline)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/BasicForm.vue | 19 +++++++++++++++++++ .../Form/src/components/FormAction.vue | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index f325740..e1341da 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -52,6 +52,8 @@ import { useModalContext } from '/@/components/Modal'; import { basicProps } from './props'; + import componentSetting from '/@/settings/componentSetting'; + import { useDesign } from '/@/hooks/web/useDesign'; import dayjs from 'dayjs'; import { useDebounceFn } from '@vueuse/core'; @@ -89,6 +91,16 @@ mergeProps.labelCol = undefined; } //update-end-author:sunjianlei date:20220923 for: 如果用户设置了labelWidth,则使labelCol失效,解决labelWidth设置无效的问题 + // update-begin--author:liaozhiyang---date:20231017---for:【QQYUN-6566】BasicForm支持一行显示(inline) + if (mergeProps.layout === 'inline') { + if (mergeProps.labelCol === componentSetting.form.labelCol) { + mergeProps.labelCol = undefined; + } + if (mergeProps.wrapperCol === componentSetting.form.wrapperCol) { + mergeProps.wrapperCol = undefined; + } + } + // update-end--author:liaozhiyang---date:20231017---for:【QQYUN-6566】BasicForm支持一行显示(inline) return mergeProps; }); @@ -380,5 +392,12 @@ margin-bottom: 8px !important; } } + // update-begin--author:liaozhiyang---date:20231017---for:【QQYUN-6566】BasicForm支持一行显示(inline) + &.ant-form-inline { + & > .ant-row { + .ant-col { width:auto !important; } + } + } + // update-end--author:liaozhiyang---date:20231017---for:【QQYUN-6566】BasicForm支持一行显示(inline) } diff --git a/src/components/Form/src/components/FormAction.vue b/src/components/Form/src/components/FormAction.vue index 4f7e721..85c43fc 100644 --- a/src/components/Form/src/components/FormAction.vue +++ b/src/components/Form/src/components/FormAction.vue @@ -65,6 +65,7 @@ actionSpan: propTypes.number.def(6), isAdvanced: propTypes.bool, hideAdvanceBtn: propTypes.bool, + layout: propTypes.oneOf(['horizontal', 'vertical', 'inline']).def('horizontal'), }, emits: ['toggle-advanced'], setup(props, { emit }) { @@ -76,10 +77,14 @@ const advancedSpanObj = showAdvancedButton ? { span: actionSpan < 6 ? 24 : actionSpan } : {}; const actionColOpt: Partial = { style: { textAlign: 'right' }, - span: showAdvancedButton ? 6 : 4, ...advancedSpanObj, ...actionColOptions, }; + // update-begin--author:liaozhiyang---date:20231017---for:【QQYUN-6566】BasicForm支持一行显示(inline) + if (props.layout !== 'inline') { + actionColOpt['span'] = showAdvancedButton ? 6 : 4; + } + // update-end--author:liaozhiyang---date:20231017---for:【QQYUN-6566】BasicForm支持一行显示(inline) return actionColOpt; });