@yorha2b-lab/autodev 1.0.20 → 1.0.21

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": "@yorha2b-lab/autodev",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "基于视觉大模型的前端(Umi+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -2,32 +2,39 @@ import { formNode } from './index'
2
2
  import { Form, Space, Button } from 'antd'
3
3
  import { PlusOutlined, PlusCircleOutlined, MinusCircleOutlined } from '@ant-design/icons'
4
4
 
5
- export const MyBaseForm = ({ item, form }) => {
5
+ const getValueFromEvent = e => {
6
+ if (Array.isArray(e)) {
7
+ return e
8
+ }
9
+ return e?.fileList
10
+ }
6
11
 
7
- const renderFormContent = ({ item }) => {
12
+ const renderFormContent = ({ item }) => {
8
13
 
9
- if (!item.name) {
10
- return item.value
11
- }
14
+ if (!item.name) {
15
+ return item.value
16
+ }
12
17
 
13
- const inputNode = (
14
- <Form.Item noStyle name={item.name} rules={item.rules} initialValue={item.value} valuePropName={item.valuePropName}>
15
- {formNode({ item })}
16
- </Form.Item>
18
+ const inputNode = (
19
+ <Form.Item noStyle name={item.name} rules={item.rules} initialValue={item.value} {...(item.type === 'upload' ? { getValueFromEvent, valuePropName: 'fileList' } : { valuePropName: item.valuePropName })}>
20
+ {formNode({ item })}
21
+ </Form.Item>
22
+ )
23
+
24
+ if (item.unit) {
25
+ return (
26
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
27
+ <div style={{ flex: 1, minWidth: 0 }}>{inputNode}</div>
28
+ <span style={{ color: '#888', whiteSpace: 'nowrap' }}>{item.unit}</span>
29
+ </div>
17
30
  )
31
+ }
18
32
 
19
- if (item.unit) {
20
- return (
21
- <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
22
- <div style={{ flex: 1, minWidth: 0 }}>{inputNode}</div>
23
- <span style={{ color: '#888', whiteSpace: 'nowrap' }}>{item.unit}</span>
24
- </div>
25
- )
26
- }
33
+ return inputNode
34
+ }
27
35
 
28
- return inputNode
29
- }
30
36
 
37
+ export const MyBaseForm = ({ item, form }) => {
31
38
  return (
32
39
  item.isList ?
33
40
  <Form.List name={item.name} initialValue={item.value}>