@yorha2b-lab/autodev 1.0.30 → 1.0.32

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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![GitHub Stars](https://img.shields.io/github/stars/yorha2b-lab/auto-crud-copilot.svg?style=flat-square)](https://github.com/yorha2b-lab/auto-crud-copilot/stargazers)
8
8
  [![License](https://img.shields.io/npm/l/@yorha2b-lab/autodev.svg?style=flat-square)](https://github.com/yorha2b-lab/auto-crud-copilot/blob/main/LICENSE)
9
9
 
10
- 基于视觉大模型的前端(Umi+Antd)全自动 CRUD 代码生成器 🚀
10
+ 基于视觉大模型的前端(React+Antd)全自动 CRUD 代码生成器 🚀
11
11
 
12
12
  <video src="https://github.com/user-attachments/assets/6d42fce1-c815-482b-8c6a-4a3b9415ba47.mp4" controls="controls" muted="muted" style="max-width: 100%; display: block; margin: 20px auto;">
13
13
  </video>
package/README_EN.md CHANGED
@@ -7,7 +7,7 @@ English | [简体中文](./README.md)
7
7
  [![GitHub Stars](https://img.shields.io/github/stars/yorha2b-lab/auto-crud-copilot.svg?style=flat-square)](https://github.com/yorha2b-lab/auto-crud-copilot/stargazers)
8
8
  [![License](https://img.shields.io/npm/l/@yorha2b-lab/autodev.svg?style=flat-square)](https://github.com/yorha2b-lab/auto-crud-copilot/blob/main/LICENSE)
9
9
 
10
- An AI-powered frontend CRUD code generator based on vision models (Umi+Antd) 🚀
10
+ An AI-powered frontend CRUD code generator based on vision models (React+Antd) 🚀
11
11
 
12
12
  <video src="https://github.com/user-attachments/assets/6d42fce1-c815-482b-8c6a-4a3b9415ba47.mp4" controls="controls" muted="muted" style="max-width: 100%; display: block; margin: 20px auto;">
13
13
  </video>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "基于视觉大模型的前端(Umi+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -77,8 +77,8 @@ const generateSmartImports = (codeStr, hasTabs) => {
77
77
  // 构建 import 语句数组
78
78
  const imports = [
79
79
  usedReact.length && `import { ${usedReact.join(', ')} } from 'react'`,
80
- `import { Link, history } from 'umi'`,
81
80
  `import { request } from '../../utils/request'`,
81
+ `import { formatQuery } from '../../utils/utils'`,
82
82
  `import { ${hasTabs ? 'tabs, ' : ''}columns, formItems, modalItems } from './resource'`,
83
83
  ...usedHooks.map(hook => `import { ${hook} } from '../../hooks/${hook}'`),
84
84
  ...usedComps.map(comp => `import { ${comp} } from '../../components/${comp}'`),
@@ -18,11 +18,11 @@ export const MyModalForm = ({ width, title, submit, record, visible, setModal, l
18
18
  const config = itemMap.get(key)
19
19
  if (config?.type?.includes('date') && value) {
20
20
  if (Array.isArray(value)) {
21
- initialData[key] = value.map(v => dayjs(isNaN(v) ? v : Number(v)))
21
+ initialData[key] = value.map(v => dayjs(v))
22
22
  } else if (typeof value === 'string' && value.includes(',')) {
23
- initialData[key] = value.split(',').map(v => dayjs(Number(v)))
23
+ initialData[key] = value.split(',').map(v => dayjs(v))
24
24
  } else {
25
- initialData[key] = dayjs(isNaN(value) ? value : Number(value))
25
+ initialData[key] = dayjs(value)
26
26
  }
27
27
  } else {
28
28
  initialData[key] = value
@@ -1,5 +1,4 @@
1
1
  import dayjs from 'dayjs'
2
- import { history } from 'umi'
3
2
  import { MyBaseForm } from './MyBaseForm'
4
3
  import { useState, useEffect } from 'react'
5
4
  import { Row, Col, Form, Button, Space } from 'antd'
@@ -10,7 +9,7 @@ export const MySearchForm = ({ form, search, loading, labelCol, setSearch, formI
10
9
 
11
10
  const handleReset = () => {
12
11
  if (syncUrlParams) {
13
- history.push({ search: '' })
12
+ window.history.replaceState(null, '', window.location.pathname)
14
13
  }
15
14
  if (customReset) {
16
15
  customReset()
@@ -37,7 +36,7 @@ export const MySearchForm = ({ form, search, loading, labelCol, setSearch, formI
37
36
  }
38
37
  })
39
38
  const params = new URLSearchParams(Object.fromEntries(Object.entries(formattedValues).filter(([key, value]) => !['', null, undefined].includes(value))))
40
- history.push({ search: params.toString() })
39
+ window.history.replaceState(null, '', `${window.location.pathname}?${params.toString()}`)
41
40
  }
42
41
  if (customFinish) {
43
42
  customFinish(formattedValues)
@@ -48,8 +48,7 @@ export const MyTable = ({ size, query, onSave, autoScroll, onChange, pagination,
48
48
  const tr = trList[Number(query.rowIndex)]
49
49
  if (tr) {
50
50
  tr.scrollIntoView({ behavior: 'smooth', block: 'center' })
51
- tr.classList.add('row-highlight-pulse')
52
- setTimeout(() => tr.classList.remove('row-highlight-pulse'), 1000)
51
+ tr.style.backgroundColor = '#e6f4ff'
53
52
  hasScrolledRef.current = query.rowIndex
54
53
  }
55
54
  }, 300)
@@ -78,12 +77,6 @@ export const MyTable = ({ size, query, onSave, autoScroll, onChange, pagination,
78
77
  return classes.filter(Boolean).join(' ')
79
78
  }}
80
79
  />
81
- <style jsx>{`
82
- :global(.row-highlight-pulse) {
83
- background-color: #e6f4ff !important;
84
- transition: background-color 0.5s ease;
85
- }
86
- `}</style>
87
80
  </div>
88
81
  )
89
82
  }
@@ -31,7 +31,8 @@ const AliyunOSSUpload = ({ path, style, value, disabled, onChange }) => {
31
31
  key: file.url,
32
32
  policy: OSSData?.policy,
33
33
  Signature: OSSData?.signature,
34
- OSSAccessKeyId: OSSData?.accessId,
34
+ OSSAccessKeyId: OSSData?.accessKeyId,
35
+ 'x-oss-security-token': OSSData?.stsToken,
35
36
  })
36
37
 
37
38
  const beforeUpload = async file => {
@@ -1,6 +1,6 @@
1
1
  export default props => {
2
2
 
3
- const query = Object.fromEntries(new URLSearchParams(location.search).entries())
3
+ const query = formatQuery(Object.fromEntries(new URLSearchParams(location.search).entries()), formItems)
4
4
 
5
5
  const [form] = Form.useForm()
6
6
  const [modal, setModal] = useState({})
@@ -1,11 +1,6 @@
1
1
  import dayjs from 'dayjs'
2
2
  import { request } from './request'
3
3
 
4
- export const paramsFormat = params => {
5
- const cleanParams = Object.fromEntries(Object.entries(params).filter(([_, v]) => ![null, undefined, ''].includes(v)))
6
- return new URLSearchParams(cleanParams).toString()
7
- }
8
-
9
4
  export const initOSS = async (url, options) => {
10
5
  const OSS = require('ali-oss')
11
6
  const crypto = require('crypto-js')
@@ -22,6 +17,18 @@ export const initOSS = async (url, options) => {
22
17
  return { client, policy, signature, ...response?.data }
23
18
  }
24
19
 
20
+ export const formatQuery = (params, formItems) => {
21
+ const cleanParams = {}
22
+ Object.keys(params).forEach(key => {
23
+ if (formItems.some(item => item.name.includes(key) && item.type?.includes('date'))) {
24
+ cleanParams[key] = Number(params[key])
25
+ } else {
26
+ cleanParams[key] = params[key] ?? null
27
+ }
28
+ })
29
+ return cleanParams
30
+ }
31
+
25
32
  export const timeRender = ({ time, date, minute }) => {
26
33
  if (!time) {
27
34
  return ''