@longhongguo/form-create-ant-design-vue 3.2.94 → 3.2.96
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.css +12 -2
- package/dist/form-create.esm.css +12 -2
- 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/parsers/flex.js +38 -5
- package/src/parsers/text.js +8 -0
- package/src/style/index.css +12 -2
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.96",
|
|
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/parsers/flex.js
CHANGED
|
@@ -110,15 +110,24 @@ export default {
|
|
|
110
110
|
ctx.rule.children = []
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// 读取 childFlex 和 childWidth 配置,用于直接设置到子元素的 style
|
|
114
|
+
const childFlex = props.childFlex ?? ctx.rule.childFlex
|
|
115
|
+
const isVertical =
|
|
116
|
+
flexDirection === 'column' || flexDirection === 'column-reverse'
|
|
117
|
+
const childWidth = isVertical
|
|
118
|
+
? props.childWidth ?? ctx.rule.childWidth ?? '100%'
|
|
119
|
+
: undefined
|
|
120
|
+
|
|
113
121
|
// 为 flex 容器的所有子组件设置 col: false,避免被 a-col 包装
|
|
122
|
+
// 同时直接给子元素设置 flex 值和宽度(如果是垂直方向)
|
|
114
123
|
// 这样可以确保子组件直接作为 flex 子项,而不是占满整行
|
|
115
124
|
if (ctx.rule.children && Array.isArray(ctx.rule.children)) {
|
|
116
125
|
ctx.rule.children.forEach((child) => {
|
|
117
126
|
if (
|
|
118
127
|
child &&
|
|
119
128
|
typeof child === 'object' &&
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
child.type !== 'DragTool' &&
|
|
130
|
+
child.type !== 'DragBox'
|
|
122
131
|
) {
|
|
123
132
|
// 只有当 col 未设置或为默认值时才设置
|
|
124
133
|
if (child.col === undefined || child.col === null) {
|
|
@@ -130,6 +139,29 @@ export default {
|
|
|
130
139
|
) {
|
|
131
140
|
child.col.show = false
|
|
132
141
|
}
|
|
142
|
+
|
|
143
|
+
// 确保子元素的 style 对象存在(使用响应式的方式)
|
|
144
|
+
if (!child.style) {
|
|
145
|
+
child.style = {}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 如果配置了 childFlex,直接给子元素设置 flex 样式
|
|
149
|
+
// 使用 Object.assign 确保样式对象被正确设置
|
|
150
|
+
if (
|
|
151
|
+
childFlex !== undefined &&
|
|
152
|
+
childFlex !== null &&
|
|
153
|
+
childFlex !== ''
|
|
154
|
+
) {
|
|
155
|
+
const flexValue = String(childFlex).trim()
|
|
156
|
+
// 直接设置 flex 属性,确保样式能够生效
|
|
157
|
+
Object.assign(child.style, { flex: flexValue })
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 如果是垂直方向且配置了 childWidth,直接给子元素设置 width 样式
|
|
161
|
+
if (isVertical && childWidth) {
|
|
162
|
+
const widthValue = String(childWidth).trim()
|
|
163
|
+
Object.assign(child.style, { width: widthValue })
|
|
164
|
+
}
|
|
133
165
|
}
|
|
134
166
|
})
|
|
135
167
|
}
|
|
@@ -145,9 +177,10 @@ export default {
|
|
|
145
177
|
if (typeof ctx.rule.wrap === 'object' && !ctx.rule.wrap.class) {
|
|
146
178
|
ctx.rule.wrap.class = ''
|
|
147
179
|
}
|
|
148
|
-
const wrapClass =
|
|
149
|
-
|
|
150
|
-
|
|
180
|
+
const wrapClass =
|
|
181
|
+
typeof ctx.rule.wrap === 'object'
|
|
182
|
+
? (ctx.rule.wrap.class || '').split(' ').filter(Boolean)
|
|
183
|
+
: []
|
|
151
184
|
if (!wrapClass.includes('_fc-reset-margin-bottom')) {
|
|
152
185
|
wrapClass.push('_fc-reset-margin-bottom')
|
|
153
186
|
if (typeof ctx.rule.wrap === 'object') {
|
package/src/parsers/text.js
CHANGED
|
@@ -216,8 +216,16 @@ export default {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// 确保 children 存在(如果没有设置,默认为空数组)
|
|
219
|
+
// 重要:始终创建新的数组,确保每个 text 组件都有独立的 children 数组引用
|
|
220
|
+
// 这样可以避免多个 text 组件绑定同一个字段时共享同一个数组引用
|
|
219
221
|
if (!ctx.rule.children) {
|
|
220
222
|
ctx.rule.children = []
|
|
223
|
+
} else if (Array.isArray(ctx.rule.children)) {
|
|
224
|
+
// 如果 children 已存在,创建一个新的数组副本,避免多个组件共享同一个数组引用
|
|
225
|
+
ctx.rule.children = [...ctx.rule.children]
|
|
226
|
+
} else {
|
|
227
|
+
// 如果不是数组,转换为数组
|
|
228
|
+
ctx.rule.children = [ctx.rule.children]
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
// 对于动态绑定的情况,初始化时设置一个占位符,确保组件能被渲染
|
package/src/style/index.css
CHANGED
|
@@ -524,12 +524,22 @@
|
|
|
524
524
|
width: auto !important;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
/* Flex 容器子项 flex 样式 */
|
|
527
|
+
/* Flex 容器子项 flex 样式 - 使用通用选择器,匹配所有直接子元素 */
|
|
528
|
+
.ant-flex._fc-flex-container > * {
|
|
529
|
+
flex: var(--fc-child-flex) !important;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/* 更具体的选择器,针对被 form-item 包裹的子元素 */
|
|
528
533
|
.ant-flex._fc-flex-container > .ant-form-item {
|
|
529
534
|
flex: var(--fc-child-flex) !important;
|
|
530
535
|
}
|
|
531
536
|
|
|
532
|
-
/* 垂直方向的 Flex 容器子项宽度样式 */
|
|
537
|
+
/* 垂直方向的 Flex 容器子项宽度样式 - 使用通用选择器 */
|
|
538
|
+
.ant-flex._fc-flex-vertical > * {
|
|
539
|
+
width: var(--fc-child-width, 100%) !important;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/* 更具体的选择器,针对被 form-item 包裹的子元素 */
|
|
533
543
|
.ant-flex._fc-flex-vertical > .ant-form-item {
|
|
534
544
|
width: var(--fc-child-width, 100%) !important;
|
|
535
545
|
}
|