@longhongguo/form-create-ant-design-vue 3.2.62 → 3.2.63

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.62",
3
+ "version": "3.2.63",
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",
@@ -100,35 +100,6 @@ export default {
100
100
  if (ctx.rule) {
101
101
  ctx.rule.col = false
102
102
  }
103
-
104
- // 读取并应用子组件的 flex 配置(支持等比分配和自由控制)
105
- // 可以从 props.flex 或 style.flex 读取
106
- const flexValue = ctx.rule.props?.flex ?? ctx.rule.style?.flex
107
- if (flexValue !== undefined && flexValue !== null && flexValue !== '') {
108
- // 确保 style 对象存在
109
- if (!ctx.prop.style) {
110
- ctx.prop.style = {}
111
- }
112
- if (!ctx.prop.props) {
113
- ctx.prop.props = {}
114
- }
115
- if (!ctx.prop.props.style) {
116
- ctx.prop.props.style = {}
117
- }
118
-
119
- // 转换 flex 值为字符串(CSS flex 值应该是字符串)
120
- // flex 值可以是数字(如 1, 2)或字符串(如 '1', '2', 'auto', 'none')
121
- let flexString = flexValue
122
- if (typeof flexValue === 'number') {
123
- flexString = String(flexValue)
124
- } else if (typeof flexValue === 'string') {
125
- flexString = flexValue.trim()
126
- }
127
-
128
- // 应用 flex 值到样式(同时设置到 prop.style 和 prop.props.style)
129
- ctx.prop.style.flex = flexString
130
- ctx.prop.props.style.flex = flexString
131
- }
132
103
  }
133
104
  }
134
105
 
@@ -143,6 +143,37 @@ export default {
143
143
  prop.type = 'a-flex'
144
144
  }
145
145
 
146
+ // 读取 childFlex 配置
147
+ const childFlex = ctx.rule.props?.childFlex ?? ctx.rule.childFlex
148
+ if (childFlex !== undefined && childFlex !== null && childFlex !== '') {
149
+ // 给 flex 容器添加自定义 class 和 CSS 变量,用于 CSS 选择器
150
+ if (!prop.props) {
151
+ prop.props = {}
152
+ }
153
+ // 添加自定义 class
154
+ if (!prop.class) {
155
+ prop.class = []
156
+ }
157
+ if (!Array.isArray(prop.class)) {
158
+ prop.class = [prop.class]
159
+ }
160
+ prop.class.push('_fc-flex-container')
161
+
162
+ // 通过 CSS 变量传递 flex 值
163
+ const flexValue = String(childFlex).trim()
164
+ // 合并到样式中,设置 CSS 变量
165
+ if (!prop.props.style) {
166
+ prop.props.style = {}
167
+ }
168
+ prop.props.style['--fc-child-flex'] = flexValue
169
+
170
+ // 同时也设置到 prop.style
171
+ if (!prop.style) {
172
+ prop.style = {}
173
+ }
174
+ prop.style['--fc-child-flex'] = flexValue
175
+ }
176
+
146
177
  // children 会通过 form-create 的机制自动渲染
147
178
  const childrenNodes = children || []
148
179
 
@@ -491,3 +491,8 @@
491
491
  ._fd-tf-col:has(._fd-tf-col) {
492
492
  width: auto !important;
493
493
  }
494
+
495
+ /* Flex 容器子项 flex 样式 */
496
+ .ant-flex._fc-flex-container > .ant-form-item {
497
+ flex: var(--fc-child-flex) !important;
498
+ }