@longhongguo/form-create-ant-design-vue 3.2.82 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longhongguo/form-create-ant-design-vue",
3
- "version": "3.2.82",
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",
@@ -9,7 +9,7 @@ export default {
9
9
  // 初始化列配置
10
10
  if (!hasProperty(props, 'columns')) {
11
11
  let columns = rule.props?.columns || []
12
- // 如果 columns 是字符串,尝试解析为 JSON
12
+ // Struct 组件返回的是数组对象,直接使用;如果是字符串,尝试解析为 JSON(向后兼容)
13
13
  if (typeof columns === 'string') {
14
14
  try {
15
15
  const parsed = JSON.parse(columns)
@@ -21,13 +21,19 @@ export default {
21
21
  columns = []
22
22
  }
23
23
  }
24
+ // 确保 columns 是数组
25
+ if (!Array.isArray(columns)) {
26
+ columns = []
27
+ }
28
+ // 过滤掉 hidden 为 true 的列
29
+ columns = columns.filter((col) => !col.hidden)
24
30
  props.columns = columns
25
31
  }
26
32
 
27
33
  // 初始化数据源
28
34
  if (!hasProperty(props, 'dataSource')) {
29
35
  let dataSource = rule.value || rule.props?.dataSource || []
30
- // 如果 dataSource 是字符串,尝试解析为 JSON(仅静态数据模式)
36
+ // Struct 组件返回的是数组对象,直接使用;如果是字符串,尝试解析为 JSON(向后兼容)
31
37
  if (typeof dataSource === 'string' && !rule.effect?.fetch) {
32
38
  try {
33
39
  const parsed = JSON.parse(dataSource)
@@ -39,6 +45,10 @@ export default {
39
45
  dataSource = []
40
46
  }
41
47
  }
48
+ // 确保 dataSource 是数组
49
+ if (!Array.isArray(dataSource)) {
50
+ dataSource = []
51
+ }
42
52
  props.dataSource = dataSource
43
53
  }
44
54