@yorha2b-lab/autodev 1.0.13 → 1.0.14

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.13",
3
+ "version": "1.0.14",
4
4
  "description": "基于视觉大模型的前端(Umi+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -44,7 +44,9 @@ const watchPart = () => {
44
44
  } catch (error) {
45
45
  console.log(chalk.red(`🤖 Pod 042: [警告] 识别程序失败。原因:${error}`))
46
46
  } finally {
47
- fs.unlinkSync(filePath)
47
+ if (fs.existsSync(filePath)) {
48
+ fs.unlinkSync(filePath)
49
+ }
48
50
  }
49
51
  })
50
52
  }
@@ -11,6 +11,9 @@ const components = {
11
11
 
12
12
  export const MyTable = ({ size, query, onSave, autoScroll, onChange, pagination, rowClassName, columns = [], rowSelection, rowKey = 'id', loading = false, dataSource = [], editable = false, scroll = { x: 'max-content' }, ...restProps }) => {
13
13
 
14
+
15
+ const hasScrolled = useRef(false)
16
+
14
17
  const mergedColumns = columns.map(col => {
15
18
  if (!col.editType) {
16
19
  return col
@@ -31,16 +34,21 @@ export const MyTable = ({ size, query, onSave, autoScroll, onChange, pagination,
31
34
  })
32
35
 
33
36
  useEffect(() => {
34
- /* if (query && autoScroll) {
35
- //如果需要可以在这里通过query来处理滚动到目标行的操作
36
- const trList = document.getElementsByClassName('ant-table-row')
37
- const index = 0 //根据query来计算索引
38
- const tr = trList[index]
39
- if (tr) {
40
- tr.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' })
41
- }
42
- } */
43
- }, [])
37
+ if (hasScrolled.current || !query || !autoScroll || !dataSource?.length) return
38
+ if (query && autoScroll && dataSource?.length > 0) {
39
+ const timer = setTimeout(() => {
40
+ const trList = document.getElementsByClassName('ant-table-row')
41
+ const tr = trList[Number(query.rowIndex)]
42
+ if (tr) {
43
+ tr.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' })
44
+ tr.style.transition = 'background-color 0.8s ease'
45
+ tr.style.backgroundColor = '#e6f4ff'
46
+ hasScrolled.current = true
47
+ }
48
+ }, 100)
49
+ return () => clearTimeout(timer)
50
+ }
51
+ }, [dataSource])
44
52
 
45
53
  return (
46
54
  <Table