@longhongguo/form-create-ant-design-vue 3.2.81 → 3.2.83
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/auto-import.js +3 -1
- 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/alias.js +3 -1
- package/src/parsers/accTable.js +115 -0
- package/src/parsers/index.js +3 -1
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.83",
|
|
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/alias.js
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { hasProperty } from '@form-create/utils/lib/type'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'accTable',
|
|
5
|
+
mergeProp(ctx) {
|
|
6
|
+
const props = ctx.prop.props || {}
|
|
7
|
+
const rule = ctx.rule
|
|
8
|
+
|
|
9
|
+
// 初始化列配置
|
|
10
|
+
if (!hasProperty(props, 'columns')) {
|
|
11
|
+
let columns = rule.props?.columns || []
|
|
12
|
+
// Struct 组件返回的是数组对象,直接使用;如果是字符串,尝试解析为 JSON(向后兼容)
|
|
13
|
+
if (typeof columns === 'string') {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = JSON.parse(columns)
|
|
16
|
+
if (Array.isArray(parsed)) {
|
|
17
|
+
columns = parsed
|
|
18
|
+
}
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.warn('accTable columns parse error:', e)
|
|
21
|
+
columns = []
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// 确保 columns 是数组
|
|
25
|
+
if (!Array.isArray(columns)) {
|
|
26
|
+
columns = []
|
|
27
|
+
}
|
|
28
|
+
// 过滤掉 hidden 为 true 的列
|
|
29
|
+
columns = columns.filter((col) => !col.hidden)
|
|
30
|
+
props.columns = columns
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 初始化数据源
|
|
34
|
+
if (!hasProperty(props, 'dataSource')) {
|
|
35
|
+
let dataSource = rule.value || rule.props?.dataSource || []
|
|
36
|
+
// Struct 组件返回的是数组对象,直接使用;如果是字符串,尝试解析为 JSON(向后兼容)
|
|
37
|
+
if (typeof dataSource === 'string' && !rule.effect?.fetch) {
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(dataSource)
|
|
40
|
+
if (Array.isArray(parsed)) {
|
|
41
|
+
dataSource = parsed
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.warn('accTable dataSource parse error:', e)
|
|
45
|
+
dataSource = []
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// 确保 dataSource 是数组
|
|
49
|
+
if (!Array.isArray(dataSource)) {
|
|
50
|
+
dataSource = []
|
|
51
|
+
}
|
|
52
|
+
props.dataSource = dataSource
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 检测 loading 状态:从 effectData('fetch') 中获取 loading 状态
|
|
56
|
+
const fetchData = ctx.effectData('fetch')
|
|
57
|
+
const isLoading = fetchData && fetchData.loading === true
|
|
58
|
+
|
|
59
|
+
// 设置 loading 状态
|
|
60
|
+
if (hasProperty(props, 'loading')) {
|
|
61
|
+
props.loading =
|
|
62
|
+
rule.props?.loading !== undefined ? rule.props.loading : isLoading
|
|
63
|
+
} else {
|
|
64
|
+
props.loading = isLoading
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 处理分页配置
|
|
68
|
+
if (!hasProperty(props, 'pagination')) {
|
|
69
|
+
const paginationConfig = rule.props?.pagination
|
|
70
|
+
if (paginationConfig === false) {
|
|
71
|
+
props.pagination = false
|
|
72
|
+
} else if (paginationConfig && typeof paginationConfig === 'object') {
|
|
73
|
+
props.pagination = {
|
|
74
|
+
current: paginationConfig.current || 1,
|
|
75
|
+
pageSize: paginationConfig.pageSize || 10,
|
|
76
|
+
total: paginationConfig.total || 0,
|
|
77
|
+
showSizeChanger: paginationConfig.showSizeChanger !== false,
|
|
78
|
+
showQuickJumper: paginationConfig.showQuickJumper || false,
|
|
79
|
+
showTotal: paginationConfig.showTotal,
|
|
80
|
+
...paginationConfig
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
// 默认不启用分页
|
|
84
|
+
props.pagination = false
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 设置其他常用配置
|
|
89
|
+
if (hasProperty(rule.props, 'bordered')) {
|
|
90
|
+
props.bordered = rule.props.bordered
|
|
91
|
+
}
|
|
92
|
+
if (hasProperty(rule.props, 'size')) {
|
|
93
|
+
props.size = rule.props.size
|
|
94
|
+
}
|
|
95
|
+
if (hasProperty(rule.props, 'scroll')) {
|
|
96
|
+
props.scroll = rule.props.scroll
|
|
97
|
+
}
|
|
98
|
+
if (hasProperty(rule.props, 'rowKey')) {
|
|
99
|
+
props.rowKey = rule.props.rowKey || 'id'
|
|
100
|
+
}
|
|
101
|
+
if (hasProperty(rule.props, 'rowSelection')) {
|
|
102
|
+
props.rowSelection = rule.props.rowSelection
|
|
103
|
+
}
|
|
104
|
+
if (hasProperty(rule.props, 'sticky')) {
|
|
105
|
+
props.sticky = rule.props.sticky
|
|
106
|
+
}
|
|
107
|
+
if (hasProperty(rule.props, 'virtual')) {
|
|
108
|
+
props.virtual = rule.props.virtual
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
render(children, ctx) {
|
|
112
|
+
// 使用默认渲染
|
|
113
|
+
return ctx.$render.defaultRender(ctx, children)
|
|
114
|
+
}
|
|
115
|
+
}
|
package/src/parsers/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import flex from './flex'
|
|
|
17
17
|
import space from './space'
|
|
18
18
|
import spin from './spin'
|
|
19
19
|
import div from './div'
|
|
20
|
+
import accTable from './accTable'
|
|
20
21
|
|
|
21
22
|
export default [
|
|
22
23
|
checkbox,
|
|
@@ -37,5 +38,6 @@ export default [
|
|
|
37
38
|
flex,
|
|
38
39
|
space,
|
|
39
40
|
spin,
|
|
40
|
-
div
|
|
41
|
+
div,
|
|
42
|
+
accTable
|
|
41
43
|
]
|