@longhongguo/form-create-ant-design-vue 3.2.53 → 3.2.55

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.53",
3
+ "version": "3.2.55",
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
@@ -27,6 +27,7 @@ export default {
27
27
  frame: 'fcFrame',
28
28
  col: PRE + 'Col',
29
29
  row: PRE + 'Row',
30
+ flex: PRE + 'Flex',
30
31
  tree: PRE + 'Tree',
31
32
  autoComplete: PRE + 'AutoComplete',
32
33
  transfer: PRE + 'Transfer',
package/src/core/maker.js CHANGED
@@ -98,6 +98,10 @@ function useText(maker) {
98
98
  maker.text = creatorFactory('text')
99
99
  }
100
100
 
101
+ function useFlex(maker) {
102
+ maker.flex = creatorFactory('flex')
103
+ }
104
+
101
105
  useAlias(maker)
102
106
  useSlider(maker)
103
107
  useFrame(maker)
@@ -106,5 +110,6 @@ useSelect(maker)
106
110
  useCusStoreSelect(maker)
107
111
  useCusUserSelect(maker)
108
112
  useText(maker)
113
+ useFlex(maker)
109
114
 
110
115
  export default maker
@@ -0,0 +1,88 @@
1
+ export default {
2
+ name: 'flex',
3
+ mergeProp(ctx) {
4
+ // 从 props 中读取 flex 布局配置
5
+ const props = ctx.rule.props || {}
6
+ const flexDirection = props.flexDirection || ctx.rule.flexDirection || 'row'
7
+ const flexWrap = props.flexWrap || ctx.rule.flexWrap || 'nowrap'
8
+ const justifyContent =
9
+ props.justifyContent || ctx.rule.justifyContent || 'flex-start'
10
+ const alignItems = props.alignItems || ctx.rule.alignItems || 'flex-start'
11
+
12
+ // 映射 CSS flexbox 值到 Ant Design Vue Flex 组件的 props
13
+ const vertical =
14
+ flexDirection === 'column' || flexDirection === 'column-reverse'
15
+ const wrap = flexWrap === 'wrap'
16
+
17
+ // 映射 justifyContent 到 justify
18
+ const justifyMap = {
19
+ 'flex-start': 'start',
20
+ 'flex-end': 'end',
21
+ center: 'center',
22
+ 'space-between': 'space-between',
23
+ 'space-around': 'space-around',
24
+ 'space-evenly': 'space-evenly'
25
+ }
26
+ const justify = justifyMap[justifyContent] || 'start'
27
+
28
+ // 映射 alignItems 到 align
29
+ const alignMap = {
30
+ 'flex-start': 'start',
31
+ 'flex-end': 'end',
32
+ center: 'center',
33
+ baseline: 'baseline',
34
+ stretch: 'stretch'
35
+ }
36
+ const align = alignMap[alignItems] || 'start'
37
+
38
+ // 设置到 prop.props,用于传递给 a-flex 组件
39
+ if (!ctx.prop.props) {
40
+ ctx.prop.props = {}
41
+ }
42
+
43
+ // 映射 Ant Design Vue Flex 组件的 props
44
+ ctx.prop.props.vertical = vertical
45
+ ctx.prop.props.wrap = wrap
46
+ ctx.prop.props.justify = justify
47
+ ctx.prop.props.align = align
48
+
49
+ // 如果设置了 gap,也传递
50
+ if (props.gap !== undefined) {
51
+ ctx.prop.props.gap = props.gap
52
+ }
53
+
54
+ // 合并其他样式到 props.style(用于非 Flex 组件控制的样式,如 padding, margin 等)
55
+ const existingStyle = ctx.rule.style || {}
56
+ // 排除已经被 Flex 组件处理的样式
57
+ const {
58
+ display,
59
+ flexDirection: _fd,
60
+ flexWrap: _fw,
61
+ justifyContent: _jc,
62
+ alignItems: _ai,
63
+ ...otherStyles
64
+ } = existingStyle
65
+ if (Object.keys(otherStyles).length > 0) {
66
+ ctx.prop.props.style = otherStyles
67
+ }
68
+
69
+ // 确保 children 存在
70
+ if (!ctx.rule.children) {
71
+ ctx.rule.children = []
72
+ }
73
+ },
74
+ render(children, ctx) {
75
+ // 使用 Ant Design Vue 的 Flex 组件
76
+ const prop = { ...ctx.prop }
77
+
78
+ // 将 type 设置为 'a-flex',form-create 会自动识别
79
+ if (prop.type === 'flex') {
80
+ prop.type = 'a-flex'
81
+ }
82
+
83
+ // children 会通过 form-create 的机制自动渲染
84
+ const childrenNodes = children || []
85
+
86
+ return ctx.vNode.make('a-flex', prop, childrenNodes)
87
+ }
88
+ }
@@ -13,6 +13,7 @@ import rangePicker from './rangePicker'
13
13
  import timeRangePicker from './timeRangePicker'
14
14
  import cusStoreSelect from './cusStoreSelect'
15
15
  import cusUserSelect from './cusUserSelect'
16
+ import flex from './flex'
16
17
 
17
18
  export default [
18
19
  checkbox,
@@ -29,5 +30,6 @@ export default [
29
30
  cascader,
30
31
  row,
31
32
  cusStoreSelect,
32
- cusUserSelect
33
+ cusUserSelect,
34
+ flex
33
35
  ]
package/types/maker.d.ts CHANGED
@@ -64,7 +64,8 @@ declare enum MakerName {
64
64
  'cusStoreSelect',
65
65
  'storeSelect',
66
66
  'cusUserSelect',
67
- 'userSelect'
67
+ 'userSelect',
68
+ 'flex'
68
69
  }
69
70
 
70
71
  type Maker = {