Skip to content

Commit

Permalink
feat(lib): 支持配置 formProps.popover 透传给ui组件 popover
Browse files Browse the repository at this point in the history
re #269
  • Loading branch information
Jino Liu committed May 1, 2023
1 parent f466120 commit 4c7cc51
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
9 changes: 4 additions & 5 deletions packages/docs/docs/zh/guide/basic-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,7 @@ schema = {
* 类型:`object`
`form-props` 支持如下两部分参数:

* 固定参数部分

和当前使用的ui库无关
1. 固定参数部分 (这部分参数和当前使用的ui库无关)
```js
// 默认值
formProps = {
Expand All @@ -802,11 +800,12 @@ formProps = {
labelPosition: 'top', // 表单域标签的位置
isMiniDes: false, // 是否优先mini形式显示描述信息(label文字和描述信息同行显示)
defaultSelectFirstOption: true, // 单选框必填,是否默认选中第一个
popover: {}, // 透传给ui 组件库的popver组件,比如element ui Popover,antd a-popover
}
```

* 当前ui库form组件的参数
如上固定参数以外的参数,都会传给当前ui库的form组件,比如elementUi el-form、IView i-form ...
2. 当前ui库form组件的参数
如上固定参数以外的参数,都会透传给当前ui库的form组件,比如elementUi el-form、IView i-form ...
```js
formProps = {
layoutColumn: 2, // 1 2 3 ,支持 1 2 3 列布局,如果使用inline表单这里配置无效
Expand Down
3 changes: 2 additions & 1 deletion packages/lib/vue2/vue2-core/src/components/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ export default {
},
props: {
placement: 'top',
trigger: 'hover'
trigger: 'hover',
...self.formProps?.popover
}
}, [
descriptionVNode,
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/vue2/vue2-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default function createForm(globalOptions = {}) {

const {
// eslint-disable-next-line no-unused-vars
layoutColumn = 1, inlineFooter, labelSuffix, isMiniDes, defaultSelectFirstOption, ...uiFormProps
layoutColumn = 1, inlineFooter, labelSuffix, isMiniDes, defaultSelectFirstOption, popover, ...uiFormProps
} = self.$props.formProps;

const { inline = false, labelPosition = 'top' } = uiFormProps;
Expand Down
3 changes: 2 additions & 1 deletion packages/lib/vue3/vue3-core/src/components/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ export default {
cursor: 'pointer'
},
placement: 'top',
trigger: 'hover'
trigger: 'hover',
...props.formProps?.popover
}, {
default: () => descriptionVNode,
reference: () => h(IconQuestion)
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/vue3/vue3-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default function createForm(globalOptions = {}) {
return () => {
const {
// eslint-disable-next-line no-unused-vars
layoutColumn = 1, inlineFooter, labelSuffix, isMiniDes, defaultSelectFirstOption, ...uiFormProps
layoutColumn = 1, inlineFooter, labelSuffix, isMiniDes, defaultSelectFirstOption, popover, ...uiFormProps
} = props.formProps;

const { inline = false, labelPosition = 'top' } = uiFormProps;
Expand Down

0 comments on commit 4c7cc51

Please sign in to comment.