You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.3 KiB
76 lines
2.3 KiB
/**
|
|
* @name: createProps
|
|
* @author: 卜启缘
|
|
* @date: 2021/5/30 10:50
|
|
* @description:createProps
|
|
* @update: 2021/5/30 10:50
|
|
*/
|
|
|
|
import {
|
|
createEditorInputProp,
|
|
createEditorSelectProp,
|
|
createEditorSwitchProp,
|
|
createEditorTableProp
|
|
} from '@/visual-editor/visual-editor.props'
|
|
|
|
// 对齐方式
|
|
const alignOptions = [
|
|
{
|
|
label: '左对齐',
|
|
value: 'left'
|
|
},
|
|
{
|
|
label: '右对齐',
|
|
value: 'right'
|
|
},
|
|
{
|
|
label: '居中对齐',
|
|
value: 'center'
|
|
}
|
|
]
|
|
|
|
export const compProps = {
|
|
'slots.default.children': createEditorTableProp({
|
|
label: '表单项',
|
|
option: {
|
|
options: [
|
|
{ label: '显示值', field: 'label' },
|
|
{ label: '绑定值', field: 'value' },
|
|
{ label: '备注', field: 'comments' }
|
|
],
|
|
showKey: 'label'
|
|
},
|
|
defaultValue: []
|
|
}),
|
|
colon: createEditorSwitchProp({ label: '是否在 label 后面添加冒号' }),
|
|
disabled: createEditorSwitchProp({ label: '是否禁用表单中的所有输入框' }),
|
|
errorMessageAlign: createEditorSelectProp({
|
|
label: '错误提示文案对齐方式',
|
|
defaultValue: 'left',
|
|
options: alignOptions
|
|
}),
|
|
inputAlign: createEditorSelectProp({
|
|
label: '输入框对齐方式',
|
|
defaultValue: 'left',
|
|
options: alignOptions
|
|
}),
|
|
labelAlign: createEditorSelectProp({
|
|
label: '表单项 label 对齐方式',
|
|
defaultValue: 'left',
|
|
options: alignOptions
|
|
}),
|
|
labelWidth: createEditorInputProp({ label: '表单项 label 宽度,默认单位为px' }),
|
|
readonly: createEditorSwitchProp({ label: '是否将表单中的所有输入框设置为只读状态' }),
|
|
scrollToError: createEditorSwitchProp({
|
|
label: '在提交表单且校验不通过时滚动至错误的表单项'
|
|
}),
|
|
showError: createEditorSwitchProp({ label: '是否在校验不通过时标红输入框' }),
|
|
showErrorMessage: createEditorSwitchProp({
|
|
label: '是否在校验不通过时在输入框下方展示错误提示'
|
|
}),
|
|
submitOnEnter: createEditorSwitchProp({ label: '是否在按下回车键时提交表单' }),
|
|
validateFirst: createEditorSwitchProp({ label: '是否在某一项校验不通过时停止校验' }),
|
|
validateTrigger: createEditorInputProp({
|
|
label: '表单校验触发时机,可选值为 onChange、onSubmit,详见下表'
|
|
})
|
|
}
|
|
|