@longhongguo/form-create-ant-design-vue 3.2.59 → 3.2.61

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longhongguo/form-create-ant-design-vue",
3
- "version": "3.2.59",
3
+ "version": "3.2.61",
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",
@@ -8,6 +8,8 @@ export default {
8
8
  const justifyContent =
9
9
  props.justifyContent || ctx.rule.justifyContent || 'flex-start'
10
10
  const alignItems = props.alignItems || ctx.rule.alignItems || 'flex-start'
11
+ const alignContent =
12
+ props.alignContent || ctx.rule.alignContent || 'flex-start'
11
13
 
12
14
  // 映射 CSS flexbox 值到 Ant Design Vue Flex 组件的 props
13
15
  const vertical =
@@ -42,7 +44,8 @@ export default {
42
44
 
43
45
  // 映射 Ant Design Vue Flex 组件的 props
44
46
  ctx.prop.props.vertical = vertical
45
- ctx.prop.props.wrap = wrap
47
+ // 注意:不设置 wrap prop,因为 Ant Design Vue 的 Flex 组件的 wrap prop 类型可能不匹配
48
+ // 换行功能完全通过 CSS 样式来实现
46
49
  ctx.prop.props.justify = justify
47
50
  ctx.prop.props.align = align
48
51
 
@@ -51,26 +54,56 @@ export default {
51
54
  ctx.prop.props.gap = props.gap
52
55
  }
53
56
 
54
- // 合并其他样式到 props.style(用于非 Flex 组件控制的样式,如 padding, margin 等)
57
+ // 合并样式(不要直接修改 ctx.rule.style,避免响应式循环)
55
58
  const existingStyle = ctx.rule.style || {}
56
59
  // 排除已经被 Flex 组件处理的样式
57
60
  const {
58
- display,
61
+ display: userDisplay,
59
62
  flexDirection: _fd,
60
63
  flexWrap: _fw,
61
64
  justifyContent: _jc,
62
65
  alignItems: _ai,
66
+ alignContent: _ac,
63
67
  ...otherStyles
64
68
  } = existingStyle
65
69
 
66
- // 确保 flex 容器占满整行,设置 width: 100%
67
- if (!ctx.prop.props.style) {
68
- ctx.prop.props.style = {}
70
+ // 构建样式对象,确保从 props 读取的配置能够应用到样式中
71
+ const flexStyles = {
72
+ // 保留用户设置的 display,如果没有则设置为 'flex'
73
+ display: userDisplay || 'flex',
74
+ // 确保 flex 容器占满整行
75
+ width: '100%',
76
+ // 在样式中设置 flexWrap,确保从 props 读取的配置能够生效
77
+ // 这是关键的:将 props.flexWrap 的值('wrap' 或 'nowrap')应用到样式中
78
+ flexWrap: flexWrap,
79
+ // 合并其他用户自定义样式
80
+ ...otherStyles
81
+ }
82
+
83
+ // 如果设置了 alignContent,添加到样式中
84
+ if (alignContent && alignContent !== 'flex-start') {
85
+ flexStyles.alignContent = alignContent
86
+ }
87
+
88
+ // 同时设置到 ctx.prop.style 和 ctx.prop.props.style
89
+ // form-create 会将 prop.style 应用到组件上,但有时也需要 prop.props.style
90
+ // 保留已有的 prop.style 和 prop.props.style,然后合并新的样式
91
+ const existingPropStyle = ctx.prop.style || {}
92
+ const existingPropsStyle = ctx.prop.props?.style || {}
93
+
94
+ // 合并样式到 ctx.prop.style(保留已有样式,新的样式优先)
95
+ ctx.prop.style = {
96
+ ...existingPropStyle,
97
+ ...flexStyles
98
+ }
99
+
100
+ // 同时也合并到 props.style,确保样式生效
101
+ if (!ctx.prop.props) {
102
+ ctx.prop.props = {}
69
103
  }
70
104
  ctx.prop.props.style = {
71
- width: '100%',
72
- ...otherStyles,
73
- ...ctx.prop.props.style
105
+ ...existingPropsStyle,
106
+ ...flexStyles
74
107
  }
75
108
 
76
109
  // 确保 children 存在