BasicForm 支持一行显示 (inline)

pull/824/head
zhangdaiscott 2023-10-18 16:57:56 +08:00
parent 0f113be77c
commit b5eeb2a361
2 changed files with 25 additions and 1 deletions

View File

@ -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使labelCollabelWidth
// update-begin--author:liaozhiyang---date:20231017---forQQYUN-6566BasicForm(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---forQQYUN-6566BasicForm(inline)
return mergeProps;
});
@ -380,5 +392,12 @@
margin-bottom: 8px !important;
}
}
// update-begin--author:liaozhiyang---date:20231017---forQQYUN-6566BasicForm(inline)
&.ant-form-inline {
& > .ant-row {
.ant-col { width:auto !important; }
}
}
// update-end--author:liaozhiyang---date:20231017---forQQYUN-6566BasicForm(inline)
}
</style>

View File

@ -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<ColEx> = {
style: { textAlign: 'right' },
span: showAdvancedButton ? 6 : 4,
...advancedSpanObj,
...actionColOptions,
};
// update-begin--author:liaozhiyang---date:20231017---forQQYUN-6566BasicForm(inline)
if (props.layout !== 'inline') {
actionColOpt['span'] = showAdvancedButton ? 6 : 4;
}
// update-end--author:liaozhiyang---date:20231017---forQQYUN-6566BasicForm(inline)
return actionColOpt;
});