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

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.60",
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 =
@@ -51,26 +53,55 @@ export default {
51
53
  ctx.prop.props.gap = props.gap
52
54
  }
53
55
 
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
-
66
- // 确保 flex 容器占满整行,设置 width: 100%
56
+ // 直接修改 ctx.rule.style,确保样式能够正确应用
57
+ // 因为 form-create 会将 ctx.rule.style 合并到最终的样式对象中
58
+ if (!ctx.rule.style) {
59
+ ctx.rule.style = {}
60
+ }
61
+
62
+ // 保留用户设置的 display: 'flex'(如果存在)
63
+ const userDisplay = ctx.rule.style.display
64
+ const existingStyle = { ...ctx.rule.style }
65
+
66
+ // 构建样式对象,确保从 props 读取的配置能够应用到样式中
67
+ ctx.rule.style = {
68
+ // 保留用户设置的 display,如果没有则设置为 'flex'
69
+ display: userDisplay || 'flex',
70
+ // 确保 flex 容器占满整行
71
+ width: '100%',
72
+ // 在样式中设置 flexWrap,确保从 props 读取的配置能够生效
73
+ // 这是关键的:将 props.flexWrap 的值直接应用到 style 中
74
+ flexWrap: flexWrap,
75
+ // 保留其他用户自定义样式(排除 flex 相关的,避免冲突)
76
+ ...Object.keys(existingStyle).reduce((acc, key) => {
77
+ // 排除 flex 相关的样式属性,因为我们通过 props 或新的样式设置
78
+ if (
79
+ ![
80
+ 'flexDirection',
81
+ 'flexWrap',
82
+ 'justifyContent',
83
+ 'alignItems',
84
+ 'alignContent'
85
+ ].includes(key)
86
+ ) {
87
+ acc[key] = existingStyle[key]
88
+ }
89
+ return acc
90
+ }, {})
91
+ }
92
+
93
+ // 如果设置了 alignContent,添加到样式中
94
+ if (alignContent && alignContent !== 'flex-start') {
95
+ ctx.rule.style.alignContent = alignContent
96
+ }
97
+
98
+ // 同时也设置到 ctx.prop.props.style,作为备用
67
99
  if (!ctx.prop.props.style) {
68
100
  ctx.prop.props.style = {}
69
101
  }
70
102
  ctx.prop.props.style = {
71
- width: '100%',
72
- ...otherStyles,
73
- ...ctx.prop.props.style
103
+ ...ctx.prop.props.style,
104
+ ...ctx.rule.style
74
105
  }
75
106
 
76
107
  // 确保 children 存在