@longhongguo/form-create-ant-design-vue 3.2.54 → 3.2.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-import.js +2 -0
- package/dist/form-create.esm.js +2 -2
- package/dist/form-create.esm.js.map +1 -1
- package/dist/form-create.js +2 -2
- package/dist/form-create.js.map +1 -1
- package/package.json +1 -1
- package/src/core/alias.js +1 -0
- package/src/parsers/flex.js +54 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longhongguo/form-create-ant-design-vue",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.55",
|
|
4
4
|
"description": "AntDesignVue版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。",
|
|
5
5
|
"main": "./dist/form-create.min.js",
|
|
6
6
|
"module": "./dist/form-create.esm.js",
|
package/src/core/alias.js
CHANGED
package/src/parsers/flex.js
CHANGED
|
@@ -3,38 +3,68 @@ export default {
|
|
|
3
3
|
mergeProp(ctx) {
|
|
4
4
|
// 从 props 中读取 flex 布局配置
|
|
5
5
|
const props = ctx.rule.props || {}
|
|
6
|
-
|
|
7
|
-
// 获取 flex 布局相关配置
|
|
8
6
|
const flexDirection = props.flexDirection || ctx.rule.flexDirection || 'row'
|
|
9
7
|
const flexWrap = props.flexWrap || ctx.rule.flexWrap || 'nowrap'
|
|
10
8
|
const justifyContent =
|
|
11
9
|
props.justifyContent || ctx.rule.justifyContent || 'flex-start'
|
|
12
10
|
const alignItems = props.alignItems || ctx.rule.alignItems || 'flex-start'
|
|
13
|
-
const alignContent =
|
|
14
|
-
props.alignContent || ctx.rule.alignContent || 'flex-start'
|
|
15
11
|
|
|
16
|
-
//
|
|
17
|
-
|
|
12
|
+
// 映射 CSS flexbox 值到 Ant Design Vue Flex 组件的 props
|
|
13
|
+
const vertical =
|
|
14
|
+
flexDirection === 'column' || flexDirection === 'column-reverse'
|
|
15
|
+
const wrap = flexWrap === 'wrap'
|
|
16
|
+
|
|
17
|
+
// 映射 justifyContent 到 justify
|
|
18
|
+
const justifyMap = {
|
|
19
|
+
'flex-start': 'start',
|
|
20
|
+
'flex-end': 'end',
|
|
21
|
+
center: 'center',
|
|
22
|
+
'space-between': 'space-between',
|
|
23
|
+
'space-around': 'space-around',
|
|
24
|
+
'space-evenly': 'space-evenly'
|
|
25
|
+
}
|
|
26
|
+
const justify = justifyMap[justifyContent] || 'start'
|
|
27
|
+
|
|
28
|
+
// 映射 alignItems 到 align
|
|
29
|
+
const alignMap = {
|
|
30
|
+
'flex-start': 'start',
|
|
31
|
+
'flex-end': 'end',
|
|
32
|
+
center: 'center',
|
|
33
|
+
baseline: 'baseline',
|
|
34
|
+
stretch: 'stretch'
|
|
35
|
+
}
|
|
36
|
+
const align = alignMap[alignItems] || 'start'
|
|
37
|
+
|
|
38
|
+
// 设置到 prop.props,用于传递给 a-flex 组件
|
|
18
39
|
if (!ctx.prop.props) {
|
|
19
40
|
ctx.prop.props = {}
|
|
20
41
|
}
|
|
21
42
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
alignItems,
|
|
32
|
-
alignContent,
|
|
33
|
-
...existingStyle
|
|
43
|
+
// 映射 Ant Design Vue Flex 组件的 props
|
|
44
|
+
ctx.prop.props.vertical = vertical
|
|
45
|
+
ctx.prop.props.wrap = wrap
|
|
46
|
+
ctx.prop.props.justify = justify
|
|
47
|
+
ctx.prop.props.align = align
|
|
48
|
+
|
|
49
|
+
// 如果设置了 gap,也传递
|
|
50
|
+
if (props.gap !== undefined) {
|
|
51
|
+
ctx.prop.props.gap = props.gap
|
|
34
52
|
}
|
|
35
53
|
|
|
36
|
-
//
|
|
37
|
-
ctx.
|
|
54
|
+
// 合并其他样式到 props.style(用于非 Flex 组件控制的样式,如 padding, margin 等)
|
|
55
|
+
const existingStyle = ctx.rule.style || {}
|
|
56
|
+
// 排除已经被 Flex 组件处理的样式
|
|
57
|
+
const {
|
|
58
|
+
display,
|
|
59
|
+
flexDirection: _fd,
|
|
60
|
+
flexWrap: _fw,
|
|
61
|
+
justifyContent: _jc,
|
|
62
|
+
alignItems: _ai,
|
|
63
|
+
...otherStyles
|
|
64
|
+
} = existingStyle
|
|
65
|
+
if (Object.keys(otherStyles).length > 0) {
|
|
66
|
+
ctx.prop.props.style = otherStyles
|
|
67
|
+
}
|
|
38
68
|
|
|
39
69
|
// 确保 children 存在
|
|
40
70
|
if (!ctx.rule.children) {
|
|
@@ -42,18 +72,17 @@ export default {
|
|
|
42
72
|
}
|
|
43
73
|
},
|
|
44
74
|
render(children, ctx) {
|
|
45
|
-
//
|
|
75
|
+
// 使用 Ant Design Vue 的 Flex 组件
|
|
46
76
|
const prop = { ...ctx.prop }
|
|
47
77
|
|
|
48
|
-
//
|
|
78
|
+
// 将 type 设置为 'a-flex',form-create 会自动识别
|
|
49
79
|
if (prop.type === 'flex') {
|
|
50
|
-
prop.type = '
|
|
80
|
+
prop.type = 'a-flex'
|
|
51
81
|
}
|
|
52
82
|
|
|
53
|
-
// style 已经在 mergeProp 中设置到 prop.props.style 了,直接使用
|
|
54
83
|
// children 会通过 form-create 的机制自动渲染
|
|
55
84
|
const childrenNodes = children || []
|
|
56
85
|
|
|
57
|
-
return ctx.vNode.make('
|
|
86
|
+
return ctx.vNode.make('a-flex', prop, childrenNodes)
|
|
58
87
|
}
|
|
59
88
|
}
|