@longhongguo/form-create-ant-design-vue 3.2.53 → 3.2.54
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/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/maker.js +5 -0
- package/src/parsers/flex.js +59 -0
- package/src/parsers/index.js +3 -1
- package/types/maker.d.ts +2 -1
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.54",
|
|
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/maker.js
CHANGED
|
@@ -98,6 +98,10 @@ function useText(maker) {
|
|
|
98
98
|
maker.text = creatorFactory('text')
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
function useFlex(maker) {
|
|
102
|
+
maker.flex = creatorFactory('flex')
|
|
103
|
+
}
|
|
104
|
+
|
|
101
105
|
useAlias(maker)
|
|
102
106
|
useSlider(maker)
|
|
103
107
|
useFrame(maker)
|
|
@@ -106,5 +110,6 @@ useSelect(maker)
|
|
|
106
110
|
useCusStoreSelect(maker)
|
|
107
111
|
useCusUserSelect(maker)
|
|
108
112
|
useText(maker)
|
|
113
|
+
useFlex(maker)
|
|
109
114
|
|
|
110
115
|
export default maker
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'flex',
|
|
3
|
+
mergeProp(ctx) {
|
|
4
|
+
// 从 props 中读取 flex 布局配置
|
|
5
|
+
const props = ctx.rule.props || {}
|
|
6
|
+
|
|
7
|
+
// 获取 flex 布局相关配置
|
|
8
|
+
const flexDirection = props.flexDirection || ctx.rule.flexDirection || 'row'
|
|
9
|
+
const flexWrap = props.flexWrap || ctx.rule.flexWrap || 'nowrap'
|
|
10
|
+
const justifyContent =
|
|
11
|
+
props.justifyContent || ctx.rule.justifyContent || 'flex-start'
|
|
12
|
+
const alignItems = props.alignItems || ctx.rule.alignItems || 'flex-start'
|
|
13
|
+
const alignContent =
|
|
14
|
+
props.alignContent || ctx.rule.alignContent || 'flex-start'
|
|
15
|
+
|
|
16
|
+
// 将 flex 样式设置到 ctx.prop.props.style,而不是直接修改 ctx.rule.style
|
|
17
|
+
// 这样可以避免触发递归更新
|
|
18
|
+
if (!ctx.prop.props) {
|
|
19
|
+
ctx.prop.props = {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 获取现有的 style(来自 rule.style 或 prop.props.style)
|
|
23
|
+
const existingStyle = ctx.rule.style || ctx.prop.props.style || {}
|
|
24
|
+
|
|
25
|
+
// 合并 flex 样式和现有样式
|
|
26
|
+
const flexStyle = {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection,
|
|
29
|
+
flexWrap,
|
|
30
|
+
justifyContent,
|
|
31
|
+
alignItems,
|
|
32
|
+
alignContent,
|
|
33
|
+
...existingStyle
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 设置到 prop.props.style,这样不会触发 rule 的响应式更新
|
|
37
|
+
ctx.prop.props.style = flexStyle
|
|
38
|
+
|
|
39
|
+
// 确保 children 存在
|
|
40
|
+
if (!ctx.rule.children) {
|
|
41
|
+
ctx.rule.children = []
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
render(children, ctx) {
|
|
45
|
+
// 复制 prop,避免修改原始对象
|
|
46
|
+
const prop = { ...ctx.prop }
|
|
47
|
+
|
|
48
|
+
// 确保 type 是 'div'
|
|
49
|
+
if (prop.type === 'flex') {
|
|
50
|
+
prop.type = 'div'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// style 已经在 mergeProp 中设置到 prop.props.style 了,直接使用
|
|
54
|
+
// children 会通过 form-create 的机制自动渲染
|
|
55
|
+
const childrenNodes = children || []
|
|
56
|
+
|
|
57
|
+
return ctx.vNode.make('div', prop, childrenNodes)
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/parsers/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import rangePicker from './rangePicker'
|
|
|
13
13
|
import timeRangePicker from './timeRangePicker'
|
|
14
14
|
import cusStoreSelect from './cusStoreSelect'
|
|
15
15
|
import cusUserSelect from './cusUserSelect'
|
|
16
|
+
import flex from './flex'
|
|
16
17
|
|
|
17
18
|
export default [
|
|
18
19
|
checkbox,
|
|
@@ -29,5 +30,6 @@ export default [
|
|
|
29
30
|
cascader,
|
|
30
31
|
row,
|
|
31
32
|
cusStoreSelect,
|
|
32
|
-
cusUserSelect
|
|
33
|
+
cusUserSelect,
|
|
34
|
+
flex
|
|
33
35
|
]
|