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

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.63",
3
+ "version": "3.2.64",
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",
@@ -143,21 +143,34 @@ 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
146
+ // 读取 flexDirection 来判断是否是垂直方向
147
+ const props = ctx.rule.props || {}
148
+ const flexDirection = props.flexDirection || ctx.rule.flexDirection || 'row'
149
+ const isVertical =
150
+ flexDirection === 'column' || flexDirection === 'column-reverse'
151
+
152
+ // 初始化 prop.props 和 prop.class(如果需要的话)
153
+ if (!prop.props) {
154
+ prop.props = {}
155
+ }
156
+
157
+ // 添加自定义 class 的辅助函数
158
+ const ensureClass = () => {
154
159
  if (!prop.class) {
155
160
  prop.class = []
156
161
  }
157
162
  if (!Array.isArray(prop.class)) {
158
163
  prop.class = [prop.class]
159
164
  }
160
- prop.class.push('_fc-flex-container')
165
+ }
166
+
167
+ // 读取 childFlex 配置
168
+ const childFlex = ctx.rule.props?.childFlex ?? ctx.rule.childFlex
169
+ if (childFlex !== undefined && childFlex !== null && childFlex !== '') {
170
+ ensureClass()
171
+ if (!prop.class.includes('_fc-flex-container')) {
172
+ prop.class.push('_fc-flex-container')
173
+ }
161
174
 
162
175
  // 通过 CSS 变量传递 flex 值
163
176
  const flexValue = String(childFlex).trim()
@@ -174,6 +187,32 @@ export default {
174
187
  prop.style['--fc-child-flex'] = flexValue
175
188
  }
176
189
 
190
+ // 如果是垂直方向,读取 childWidth 配置(默认 100%)
191
+ if (isVertical) {
192
+ const childWidth =
193
+ ctx.rule.props?.childWidth ?? ctx.rule.childWidth ?? '100%'
194
+
195
+ ensureClass()
196
+ if (!prop.class.includes('_fc-flex-container')) {
197
+ prop.class.push('_fc-flex-container')
198
+ }
199
+ if (!prop.class.includes('_fc-flex-vertical')) {
200
+ prop.class.push('_fc-flex-vertical')
201
+ }
202
+
203
+ // 通过 CSS 变量传递宽度值
204
+ const widthValue = String(childWidth).trim()
205
+ if (!prop.props.style) {
206
+ prop.props.style = {}
207
+ }
208
+ prop.props.style['--fc-child-width'] = widthValue
209
+
210
+ if (!prop.style) {
211
+ prop.style = {}
212
+ }
213
+ prop.style['--fc-child-width'] = widthValue
214
+ }
215
+
177
216
  // children 会通过 form-create 的机制自动渲染
178
217
  const childrenNodes = children || []
179
218
 
@@ -496,3 +496,8 @@
496
496
  .ant-flex._fc-flex-container > .ant-form-item {
497
497
  flex: var(--fc-child-flex) !important;
498
498
  }
499
+
500
+ /* 垂直方向的 Flex 容器子项宽度样式 */
501
+ .ant-flex._fc-flex-vertical > .ant-form-item {
502
+ width: var(--fc-child-width, 100%) !important;
503
+ }