@longhongguo/form-create-ant-design-vue 3.2.86 → 3.2.88
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.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/accTable.js +155 -21
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.88",
|
|
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/accTable.js
CHANGED
|
@@ -13,13 +13,31 @@ function getValue(obj, path) {
|
|
|
13
13
|
return value
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
// 文件加载时立即打印
|
|
17
|
+
console.log('[accTable] ✅ accTable.js 文件已加载')
|
|
18
|
+
|
|
16
19
|
export default {
|
|
17
20
|
name: 'accTable',
|
|
18
21
|
mergeProp(ctx) {
|
|
22
|
+
console.log('[accTable] ========== mergeProp 被调用 ==========')
|
|
23
|
+
console.log('[accTable] 调用堆栈:', new Error().stack)
|
|
19
24
|
const props = ctx.prop.props || {}
|
|
20
25
|
const rule = ctx.rule
|
|
21
26
|
const api = ctx.api
|
|
22
27
|
|
|
28
|
+
console.log('[accTable] mergeProp 基本信息:', {
|
|
29
|
+
ruleType: rule.type,
|
|
30
|
+
ruleName: rule.name,
|
|
31
|
+
hasEffect: !!rule.effect,
|
|
32
|
+
hasFetch: !!rule.effect?.fetch,
|
|
33
|
+
fetchValue: rule.effect?.fetch,
|
|
34
|
+
fetchType: typeof rule.effect?.fetch,
|
|
35
|
+
hasPagination: !!rule.props?.pagination,
|
|
36
|
+
paginationConfig: rule.props?.pagination,
|
|
37
|
+
paginationType: typeof rule.props?.pagination,
|
|
38
|
+
allRuleProps: Object.keys(rule.props || {})
|
|
39
|
+
})
|
|
40
|
+
|
|
23
41
|
// 初始化列配置
|
|
24
42
|
if (!hasProperty(props, 'columns')) {
|
|
25
43
|
let columns = rule.props?.columns || []
|
|
@@ -79,8 +97,20 @@ export default {
|
|
|
79
97
|
}
|
|
80
98
|
|
|
81
99
|
// 处理分页配置
|
|
100
|
+
console.log('[accTable] 开始处理分页配置:', {
|
|
101
|
+
hasPaginationProp: hasProperty(props, 'pagination'),
|
|
102
|
+
paginationConfig: rule.props?.pagination,
|
|
103
|
+
paginationConfigType: typeof rule.props?.pagination
|
|
104
|
+
})
|
|
105
|
+
|
|
82
106
|
if (!hasProperty(props, 'pagination')) {
|
|
83
107
|
const paginationConfig = rule.props?.pagination
|
|
108
|
+
console.log('[accTable] 分页配置检查:', {
|
|
109
|
+
paginationConfig,
|
|
110
|
+
isFalse: paginationConfig === false,
|
|
111
|
+
isObject: paginationConfig && typeof paginationConfig === 'object'
|
|
112
|
+
})
|
|
113
|
+
|
|
84
114
|
if (paginationConfig === false) {
|
|
85
115
|
props.pagination = false
|
|
86
116
|
} else if (paginationConfig && typeof paginationConfig === 'object') {
|
|
@@ -94,8 +124,17 @@ export default {
|
|
|
94
124
|
...paginationConfig
|
|
95
125
|
}
|
|
96
126
|
|
|
127
|
+
console.log('[accTable] 检查是否需要添加分页请求参数:', {
|
|
128
|
+
hasFetch: !!rule.effect?.fetch,
|
|
129
|
+
fetchType: typeof rule.effect?.fetch,
|
|
130
|
+
fetchValue: rule.effect?.fetch,
|
|
131
|
+
paginationCurrent: paginationConfig.current,
|
|
132
|
+
currentDefined: paginationConfig.current !== undefined
|
|
133
|
+
})
|
|
134
|
+
|
|
97
135
|
// 如果启用了分页且有远程数据源(fetch effect),添加 onChange 事件处理和初始化分页参数
|
|
98
136
|
if (rule.effect?.fetch && paginationConfig.current !== undefined) {
|
|
137
|
+
console.log('[accTable] 进入分页请求参数处理逻辑')
|
|
99
138
|
// 获取分页参数配置
|
|
100
139
|
const pageParamName = rule.props?.paginationPageParam || 'page'
|
|
101
140
|
const pageSizeParamName =
|
|
@@ -106,53 +145,147 @@ export default {
|
|
|
106
145
|
const responseTotalPath =
|
|
107
146
|
rule.props?.paginationResponseTotalPath || 'total'
|
|
108
147
|
|
|
109
|
-
|
|
148
|
+
console.log('[accTable] 分页配置初始化:', {
|
|
149
|
+
hasFetch: !!rule.effect?.fetch,
|
|
150
|
+
paginationConfig,
|
|
151
|
+
pageParamName,
|
|
152
|
+
pageSizeParamName,
|
|
153
|
+
paramType,
|
|
154
|
+
currentPage: pagination.current,
|
|
155
|
+
currentPageSize: pagination.pageSize
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
// 包装 fetch 配置,通过 beforeFetch 钩子动态注入分页参数
|
|
110
159
|
const originalFetch = rule.effect.fetch
|
|
160
|
+
console.log('[accTable] 原始 fetch 配置:', {
|
|
161
|
+
type: typeof originalFetch,
|
|
162
|
+
isObject: typeof originalFetch === 'object',
|
|
163
|
+
originalFetch
|
|
164
|
+
})
|
|
165
|
+
|
|
111
166
|
if (typeof originalFetch === 'object') {
|
|
112
167
|
// 保存原始配置和分页参数配置到闭包中
|
|
113
|
-
const savedOriginalFetch = { ...originalFetch }
|
|
114
168
|
const savedParamType = paramType
|
|
115
169
|
const savedPageParamName = pageParamName
|
|
116
170
|
const savedPageSizeParamName = pageSizeParamName
|
|
171
|
+
const savedOriginalBeforeFetch = originalFetch.beforeFetch
|
|
117
172
|
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
baseOption = { ...savedOriginalFetch, ...actionResult }
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// 使用扩展运算符创建新配置,保留所有原始属性(包括函数)
|
|
130
|
-
const fetchOption = { ...baseOption }
|
|
173
|
+
// 添加 beforeFetch 钩子来注入分页参数
|
|
174
|
+
originalFetch.beforeFetch = (config, { rule: r, api: a }) => {
|
|
175
|
+
console.log('[accTable] beforeFetch 被调用:', {
|
|
176
|
+
configBefore: JSON.parse(JSON.stringify(config)),
|
|
177
|
+
ruleProps: r.props,
|
|
178
|
+
pagination: r.props?.pagination
|
|
179
|
+
})
|
|
131
180
|
|
|
132
181
|
// 获取当前分页配置
|
|
133
182
|
const currentPagination = r.props?.pagination
|
|
183
|
+
console.log('[accTable] 当前分页配置:', {
|
|
184
|
+
currentPagination,
|
|
185
|
+
isObject: typeof currentPagination === 'object',
|
|
186
|
+
currentPage: currentPagination?.current,
|
|
187
|
+
currentPageSize: currentPagination?.pageSize
|
|
188
|
+
})
|
|
189
|
+
|
|
134
190
|
if (currentPagination && typeof currentPagination === 'object') {
|
|
135
191
|
const currentPage = currentPagination.current || 1
|
|
136
192
|
const currentPageSize = currentPagination.pageSize || 10
|
|
137
193
|
|
|
138
|
-
|
|
194
|
+
console.log('[accTable] 准备添加分页参数:', {
|
|
195
|
+
savedParamType,
|
|
196
|
+
savedPageParamName,
|
|
197
|
+
savedPageSizeParamName,
|
|
198
|
+
currentPage,
|
|
199
|
+
currentPageSize,
|
|
200
|
+
existingQuery: config.query,
|
|
201
|
+
existingData: config.data
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
// 添加分页参数(使用闭包中保存的参数名)
|
|
139
205
|
if (savedParamType === 'query') {
|
|
140
|
-
|
|
141
|
-
|
|
206
|
+
// 合并已有的 query 参数,确保不覆盖用户自定义的参数
|
|
207
|
+
config.query = {
|
|
208
|
+
...(config.query || {}),
|
|
142
209
|
[savedPageParamName]: currentPage,
|
|
143
210
|
[savedPageSizeParamName]: currentPageSize
|
|
144
211
|
}
|
|
212
|
+
console.log('[accTable] 添加 query 参数后:', {
|
|
213
|
+
query: config.query
|
|
214
|
+
})
|
|
145
215
|
} else {
|
|
146
|
-
|
|
147
|
-
|
|
216
|
+
// 合并已有的 data 参数,确保不覆盖用户自定义的参数
|
|
217
|
+
config.data = {
|
|
218
|
+
...(config.data || {}),
|
|
148
219
|
[savedPageParamName]: currentPage,
|
|
149
220
|
[savedPageSizeParamName]: currentPageSize
|
|
150
221
|
}
|
|
222
|
+
console.log('[accTable] 添加 data 参数后:', {
|
|
223
|
+
data: config.data
|
|
224
|
+
})
|
|
151
225
|
}
|
|
226
|
+
} else {
|
|
227
|
+
console.warn('[accTable] 分页配置无效,无法添加分页参数:', {
|
|
228
|
+
currentPagination,
|
|
229
|
+
type: typeof currentPagination
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// 调用原始的 beforeFetch 钩子(如果存在)
|
|
234
|
+
if (
|
|
235
|
+
savedOriginalBeforeFetch &&
|
|
236
|
+
typeof savedOriginalBeforeFetch === 'function'
|
|
237
|
+
) {
|
|
238
|
+
console.log('[accTable] 调用原始 beforeFetch 钩子')
|
|
239
|
+
return savedOriginalBeforeFetch(config, { rule: r, api: a })
|
|
152
240
|
}
|
|
153
241
|
|
|
154
|
-
|
|
242
|
+
console.log('[accTable] beforeFetch 完成,最终 config:', {
|
|
243
|
+
query: config.query,
|
|
244
|
+
data: config.data,
|
|
245
|
+
action: config.action
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// 初始化时也添加分页参数到配置中
|
|
250
|
+
const currentPage = pagination.current || 1
|
|
251
|
+
const currentPageSize = pagination.pageSize || 10
|
|
252
|
+
|
|
253
|
+
console.log('[accTable] 初始化分页参数到 fetch 配置:', {
|
|
254
|
+
paramType,
|
|
255
|
+
pageParamName,
|
|
256
|
+
pageSizeParamName,
|
|
257
|
+
currentPage,
|
|
258
|
+
currentPageSize
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
if (paramType === 'query') {
|
|
262
|
+
if (!originalFetch.query) {
|
|
263
|
+
originalFetch.query = {}
|
|
264
|
+
}
|
|
265
|
+
originalFetch.query[pageParamName] = currentPage
|
|
266
|
+
originalFetch.query[pageSizeParamName] = currentPageSize
|
|
267
|
+
console.log('[accTable] 初始化后的 query:', originalFetch.query)
|
|
268
|
+
} else {
|
|
269
|
+
if (!originalFetch.data) {
|
|
270
|
+
originalFetch.data = {}
|
|
271
|
+
}
|
|
272
|
+
originalFetch.data[pageParamName] = currentPage
|
|
273
|
+
originalFetch.data[pageSizeParamName] = currentPageSize
|
|
274
|
+
console.log('[accTable] 初始化后的 data:', originalFetch.data)
|
|
155
275
|
}
|
|
276
|
+
|
|
277
|
+
console.log('[accTable] 最终 fetch 配置:', {
|
|
278
|
+
action: originalFetch.action,
|
|
279
|
+
method: originalFetch.method,
|
|
280
|
+
query: originalFetch.query,
|
|
281
|
+
data: originalFetch.data,
|
|
282
|
+
hasBeforeFetch: typeof originalFetch.beforeFetch === 'function'
|
|
283
|
+
})
|
|
284
|
+
} else {
|
|
285
|
+
console.warn('[accTable] fetch 配置不是对象类型:', {
|
|
286
|
+
type: typeof originalFetch,
|
|
287
|
+
originalFetch
|
|
288
|
+
})
|
|
156
289
|
}
|
|
157
290
|
|
|
158
291
|
// 添加分页 onChange 事件处理
|
|
@@ -252,6 +385,7 @@ export default {
|
|
|
252
385
|
}
|
|
253
386
|
},
|
|
254
387
|
render(children, ctx) {
|
|
388
|
+
console.log('[accTable] render 方法被调用')
|
|
255
389
|
// 使用默认渲染
|
|
256
390
|
return ctx.$render.defaultRender(ctx, children)
|
|
257
391
|
}
|