@longhongguo/form-create-ant-design-vue 3.2.62 → 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/dist/form-create.css +10 -0
- package/dist/form-create.esm.css +10 -0
- 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/core/manager.js +0 -29
- package/src/parsers/flex.js +70 -0
- package/src/style/index.css +10 -0
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.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",
|
package/src/core/manager.js
CHANGED
|
@@ -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
|
|
package/src/parsers/flex.js
CHANGED
|
@@ -143,6 +143,76 @@ export default {
|
|
|
143
143
|
prop.type = 'a-flex'
|
|
144
144
|
}
|
|
145
145
|
|
|
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 = () => {
|
|
159
|
+
if (!prop.class) {
|
|
160
|
+
prop.class = []
|
|
161
|
+
}
|
|
162
|
+
if (!Array.isArray(prop.class)) {
|
|
163
|
+
prop.class = [prop.class]
|
|
164
|
+
}
|
|
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
|
+
}
|
|
174
|
+
|
|
175
|
+
// 通过 CSS 变量传递 flex 值
|
|
176
|
+
const flexValue = String(childFlex).trim()
|
|
177
|
+
// 合并到样式中,设置 CSS 变量
|
|
178
|
+
if (!prop.props.style) {
|
|
179
|
+
prop.props.style = {}
|
|
180
|
+
}
|
|
181
|
+
prop.props.style['--fc-child-flex'] = flexValue
|
|
182
|
+
|
|
183
|
+
// 同时也设置到 prop.style
|
|
184
|
+
if (!prop.style) {
|
|
185
|
+
prop.style = {}
|
|
186
|
+
}
|
|
187
|
+
prop.style['--fc-child-flex'] = flexValue
|
|
188
|
+
}
|
|
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
|
+
|
|
146
216
|
// children 会通过 form-create 的机制自动渲染
|
|
147
217
|
const childrenNodes = children || []
|
|
148
218
|
|
package/src/style/index.css
CHANGED
|
@@ -491,3 +491,13 @@
|
|
|
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
|
+
}
|
|
499
|
+
|
|
500
|
+
/* 垂直方向的 Flex 容器子项宽度样式 */
|
|
501
|
+
.ant-flex._fc-flex-vertical > .ant-form-item {
|
|
502
|
+
width: var(--fc-child-width, 100%) !important;
|
|
503
|
+
}
|