@lxzy/code-snippet 0.0.16 → 0.0.19

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.
Files changed (37) hide show
  1. package/.editorconfig +0 -0
  2. package/.omo/run-continuation/ses_f4ca3608cffeuohW7wflg38h6k.json +10 -0
  3. package/.omo/run-continuation/ses_f4cf6f2d5ffeUd1y5C6hULHcXe.json +10 -0
  4. package/.opencode/commands/push-yw.md +1 -1
  5. package/index.html +1 -1
  6. package/package.json +15 -10
  7. package/public/DBX_0.6.63_x64-setup.exe +4 -0
  8. package/src/app-vite.tsx +30 -25
  9. package/src/components/ErrorBoundary/index.tsx +1 -21
  10. package/src/{global.css → global.less} +8 -0
  11. package/src/pages/home.tsx +85 -6
  12. package/src/pages/ly/ProFormUpload/icons/audio.png +0 -0
  13. package/src/pages/ly/ProFormUpload/icons/excel.png +0 -0
  14. package/src/pages/ly/ProFormUpload/icons/file.png +0 -0
  15. package/src/pages/ly/ProFormUpload/icons/pdf.png +0 -0
  16. package/src/pages/ly/ProFormUpload/icons/ppt.png +0 -0
  17. package/src/pages/ly/ProFormUpload/icons/rar.png +0 -0
  18. package/src/pages/ly/ProFormUpload/icons/txt.png +0 -0
  19. package/src/pages/ly/ProFormUpload/icons/video.png +0 -0
  20. package/src/pages/ly/ProFormUpload/icons/word.png +0 -0
  21. package/src/pages/ly/ProFormUpload/icons/zip.png +0 -0
  22. package/src/pages/ly/ProFormUpload/index.less +158 -0
  23. package/src/pages/ly/ProFormUpload/index.tsx +276 -0
  24. package/src/pages/ly/ProFormUpload/service.ts +79 -0
  25. package/src/umi/index.ts +2 -2
  26. package/tsconfig.json +10 -5
  27. package/vite.config.ts +0 -44
  28. package/public/cdn/antd.min.css +0 -10
  29. package/public/cdn/antd.min.js +0 -26
  30. package/public/cdn/axios.min.js +0 -3
  31. package/public/cdn/lodash.min.js +0 -140
  32. package/public/cdn/moment.min.js +0 -2
  33. package/public/cdn/react-dom.development.min.js +0 -1
  34. package/public/cdn/react-dom.production.min.js +0 -245
  35. package/public/cdn/react.development.min.js +0 -1
  36. package/public/cdn/react.production.min.js +0 -31
  37. package/src/main.tsx +0 -24
package/.editorconfig CHANGED
File without changes
@@ -0,0 +1,10 @@
1
+ {
2
+ "sessionID": "ses_f4ca3608cffeuohW7wflg38h6k",
3
+ "updatedAt": "2026-09-18T07:19:48.930Z",
4
+ "sources": {
5
+ "background-task": {
6
+ "state": "idle",
7
+ "updatedAt": "2026-09-18T07:19:48.930Z"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "sessionID": "ses_f4cf6f2d5ffeUd1y5C6hULHcXe",
3
+ "updatedAt": "2026-09-18T07:03:07.699Z",
4
+ "sources": {
5
+ "background-task": {
6
+ "state": "idle",
7
+ "updatedAt": "2026-09-18T07:03:07.699Z"
8
+ }
9
+ }
10
+ }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: 自动发布到npm
3
3
  agent: build
4
- model: opencode/mimo-v2.5-free
4
+ model: opencode/deepseek-v4.1-flash-free
5
5
  ---
6
6
 
7
7
  修改 package.json 里的 version 字段,版本号根据 patch bump 规则加 1
package/index.html CHANGED
@@ -14,6 +14,6 @@
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
17
- <script type="module" src="/src/main.tsx"></script>
17
+ <script type="module" src="/src/app-vite.tsx"></script>
18
18
  </body>
19
19
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lxzy/code-snippet",
3
- "version": "0.0.16",
3
+ "version": "0.0.19",
4
4
  "files": [
5
5
  "*",
6
6
  "!dist",
@@ -17,11 +17,11 @@
17
17
  "pub": "npm publish"
18
18
  },
19
19
  "dependencies": {
20
- "@ant-design/icons": "^5",
21
- "@ant-design/pro-components": "^2.6.0",
20
+ "@ant-design/icons": "^4",
21
+ "@ant-design/pro-components": "^1",
22
22
  "@ice/stark-app": "^1.5.0",
23
23
  "ahooks": "^3.1.9",
24
- "antd": "5.27.2",
24
+ "antd": "4",
25
25
  "axios": "^1.18.1",
26
26
  "classnames": "^2.3.0",
27
27
  "dayjs": "^1.11.0",
@@ -31,17 +31,16 @@
31
31
  "lodash-es": "^4.17.21",
32
32
  "mockjs": "^1.1.0",
33
33
  "moment": "^2.29.0",
34
- "react": "^18.0.0",
35
- "react-dom": "^18.0.0",
36
- "react-router-dom": "^6",
37
- "tslib": "^2.8.1",
34
+ "react": "^17",
35
+ "react-dom": "^17",
36
+ "react-router": "5.3.4",
37
+ "react-router-dom": "5.3.4",
38
38
  "unstated-next": "^1.1.0",
39
39
  "validator": "^13.7.0"
40
40
  },
41
41
  "devDependencies": {
42
+ "@types/react": "^17",
42
43
  "@types/node": "^22.1.0",
43
- "@types/react": "^18.0.0",
44
- "@types/react-dom": "^18.0.0",
45
44
  "@vitejs/plugin-react-swc": "^3",
46
45
  "less": "^4.6.7",
47
46
  "prettier": "^2.2.0",
@@ -49,5 +48,11 @@
49
48
  "vite": "^6.0.0",
50
49
  "vite-plugin-external": "^6.2.2",
51
50
  "vite-plugin-mock": "^3.0.2"
51
+ },
52
+ "resolutions": {
53
+ "@types/react": "^17",
54
+ "@types/react-dom": "^17",
55
+ "@types/react-router": "5.1.20",
56
+ "@types/react-router-dom": "5.3.3"
52
57
  }
53
58
  }
@@ -0,0 +1,4 @@
1
+ [diffend] Oversized file quarantined before diffing.
2
+ name: package/public/DBX_0.6.63_x64-setup.exe
3
+ size: 33928008 bytes
4
+ sha256: 29bf221d2a749b233b36ad8b9456f97b54e63af6bba65bc0caf1a7a5e61c72d9
package/src/app-vite.tsx CHANGED
@@ -1,20 +1,23 @@
1
1
  import { Suspense, lazy, useEffect } from 'react';
2
+ import ReactDom from 'react-dom';
2
3
  import {
3
- Routes,
4
+ Switch,
4
5
  Route,
5
- Navigate,
6
+ Redirect,
6
7
  useLocation,
7
- BrowserRouter,
8
+ HashRouter,
8
9
  } from 'react-router-dom';
9
-
10
10
  import history from '@/umi';
11
11
  import BasicLayout from '@/layouts/index';
12
12
  import { getBasename } from '@ice/stark-app';
13
13
  import routes from '../routes';
14
14
  import { PageLoading } from '@ant-design/pro-components';
15
15
  import { ConfigProvider } from 'antd';
16
+ import 'antd/es/notification/style/index.less';
16
17
  import moment from 'moment';
17
18
  import 'moment/dist/locale/zh-cn';
19
+ import './global.less';
20
+
18
21
  moment.locale('zh-cn');
19
22
 
20
23
  const pageModules = import.meta.glob([
@@ -43,32 +46,34 @@ const RouteWrapper = ({ componentPath }) => {
43
46
  const App = () => {
44
47
  return (
45
48
  <ConfigProvider>
46
- <BrowserRouter basename={getBasename()}>
49
+ <HashRouter>
47
50
  <BasicLayout>
48
51
  <Suspense fallback={<PageLoading />}>
49
- <Routes>
50
- {routes.map((route, i) =>
51
- route.redirect ? (
52
- <Route
53
- key={route.path || i}
54
- path={route.path}
55
- element={<Navigate to={route.redirect} replace />}
56
- />
57
- ) : (
58
- <Route
59
- key={route.path || i}
60
- path={route.path}
61
- element={<RouteWrapper componentPath={route.component} />}
62
- />
63
- ),
64
- )}
65
- <Route path="*" element={<Navigate to="/404" replace />} />
66
- </Routes>
67
- </Suspense>
52
+ <Switch>
53
+ {routes.map((route, i) =>
54
+ route.redirect ? (
55
+ <Route key={route.path || i} path={route.path} exact>
56
+ <Redirect to={route.redirect} />
57
+ </Route>
58
+ ) : (
59
+ <Route
60
+ key={route.path || i}
61
+ path={route.path}
62
+ exact={route.path !== undefined}
63
+ render={() => (
64
+ <RouteWrapper componentPath={route.component} />
65
+ )}
66
+ />
67
+ ),
68
+ )}
69
+ </Switch>
70
+ </Suspense>
68
71
  </BasicLayout>
69
- </BrowserRouter>
72
+ </HashRouter>
70
73
  </ConfigProvider>
71
74
  );
72
75
  };
73
76
 
74
77
  export default App;
78
+
79
+ ReactDom.render(<App></App>, document.getElementById('root'));
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Button, Result } from 'antd';
3
3
 
4
- class ErrorBoundary extends React.Component {
4
+ class ErrorBoundary extends React.Component<any> {
5
5
  state = { hasError: false, isChunkError: false, errorMessage: '' };
6
6
 
7
7
  static getDerivedStateFromError(error) {
@@ -21,10 +21,6 @@ class ErrorBoundary extends React.Component {
21
21
  window.location.reload();
22
22
  };
23
23
 
24
- handleRetry = () => {
25
- this.setState({ hasError: false, isChunkError: false });
26
- };
27
-
28
24
  render() {
29
25
  if (this.state.hasError) {
30
26
  if (this.state.isChunkError) {
@@ -37,26 +33,10 @@ class ErrorBoundary extends React.Component {
37
33
  <Button type="primary" key="refresh" onClick={this.handleRefresh}>
38
34
  刷新浏览器
39
35
  </Button>,
40
- <Button key="retry" onClick={this.handleRetry}>
41
- 重试
42
- </Button>,
43
36
  ]}
44
37
  />
45
38
  );
46
39
  }
47
-
48
- return (
49
- <Result
50
- status="error"
51
- title="页面出错了"
52
- subTitle={this.state.errorMessage}
53
- extra={
54
- <Button type="primary" onClick={this.handleRefresh}>
55
- 刷新浏览器
56
- </Button>
57
- }
58
- />
59
- );
60
40
  }
61
41
 
62
42
  return this.props.children;
@@ -10,3 +10,11 @@ body,
10
10
  #root > div {
11
11
  height: 100%;
12
12
  }
13
+
14
+ .ant-modal-content {
15
+ border-radius: 8px;
16
+ }
17
+
18
+ .ant-modal-header {
19
+ border-radius: 8px;
20
+ }
@@ -1,13 +1,92 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
2
- import styles from './index.module.less';
3
- import { DatePicker } from 'antd';
1
+ import React, { useState } from 'react';
2
+ import { Button, Table, message } from 'antd';
3
+ import { ProTable } from '@ant-design/pro-components';
4
4
 
5
5
  export default function Home(props) {
6
- useEffect(() => {}, [a]);
7
- const a = 1;
6
+ const dataSource = [
7
+ {
8
+ id: 1,
9
+ list: [
10
+ {
11
+ skuId: 1,
12
+ },
13
+ {
14
+ skuId: 2,
15
+ },
16
+ ],
17
+ },
18
+ {
19
+ id: 2,
20
+ list: [
21
+ {
22
+ skuId: 3,
23
+ },
24
+ {
25
+ skuId: 4,
26
+ },
27
+ ],
28
+ },
29
+ ];
30
+ const [selectedMap, setSelectedMap] = useState({});
31
+
32
+ function changeSelected(id, rows) {
33
+ setSelectedMap((prev) => ({ ...prev, [id]: rows }));
34
+ }
35
+
36
+ function outputSelected() {
37
+ const selectedSkus = dataSource.flatMap(
38
+ (record) => selectedMap[record.id] || [],
39
+ );
40
+ console.log('勾选的 sku 数据', selectedSkus);
41
+ }
42
+
8
43
  return (
9
44
  <div>
10
- <DatePicker></DatePicker>
45
+ <ProTable
46
+ footer={null}
47
+ options={false}
48
+ dataSource={dataSource}
49
+ rowKey={'id'}
50
+ columns={[{ dataIndex: 'id', title: 'id' }]}
51
+ expandable={{
52
+ expandedRowRender: (record) => {
53
+ return (
54
+ <SkuTable
55
+ record={record}
56
+ value={selectedMap[record.id]}
57
+ onChange={(rows) => changeSelected(record.id, rows)}
58
+ ></SkuTable>
59
+ );
60
+ },
61
+ }}
62
+ ></ProTable>
63
+ <Button type="primary" onClick={outputSelected}>
64
+ 输出勾选数据
65
+ </Button>
11
66
  </div>
12
67
  );
13
68
  }
69
+
70
+ function SkuTable(props) {
71
+ const { record, value, onChange } = props;
72
+ const { list } = record;
73
+ const selectedRows = value || [];
74
+
75
+ function changeSelection(keys, rows) {
76
+ onChange?.(rows);
77
+ }
78
+
79
+ return (
80
+ <Table
81
+ footer={null}
82
+ pagination={false}
83
+ dataSource={list}
84
+ rowKey={'skuId'}
85
+ columns={[{ dataIndex: 'skuId', title: 'skuId' }]}
86
+ rowSelection={{
87
+ selectedRowKeys: selectedRows.map((item) => item.skuId),
88
+ onChange: changeSelection,
89
+ }}
90
+ ></Table>
91
+ );
92
+ }
@@ -0,0 +1,158 @@
1
+ // 包裹容器:卡片模式下自定义卡片因多了文件名而高于 antd 默认项高,
2
+ // 需把列表项容器高度改为自适应,否则换行后会与下一行重叠。
3
+ // antd v5 用 cssinjs 运行时注入样式,与本地选择器特异性相同时会覆盖本地样式,故用 !important 提升优先级。
4
+ .wrapper {
5
+ :global {
6
+ .ant-upload-list-picture-card {
7
+ align-items: flex-start;
8
+ }
9
+
10
+ .ant-upload-list-picture-card .ant-upload-list-item-container {
11
+ height: auto !important;
12
+ }
13
+ }
14
+ }
15
+
16
+ .card {
17
+ position: relative;
18
+ display: flex;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ width: 104px;
22
+ }
23
+
24
+ .thumb {
25
+ position: relative;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ width: 104px;
30
+ height: 104px;
31
+ padding: 8px;
32
+ overflow: hidden;
33
+ background-color: #fafafa;
34
+ border: 1px solid #d9d9d9;
35
+ border-radius: 8px;
36
+ cursor: pointer;
37
+
38
+ img {
39
+ max-width: 100%;
40
+ max-height: 100%;
41
+ object-fit: contain;
42
+ }
43
+
44
+ video {
45
+ max-width: 100%;
46
+ max-height: 100%;
47
+ object-fit: contain;
48
+ }
49
+ }
50
+
51
+ .mask {
52
+ position: absolute;
53
+ inset: 0;
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ gap: 12px;
58
+ color: #fff;
59
+ font-size: 16px;
60
+ background-color: rgba(0, 0, 0, 0.45);
61
+ opacity: 0;
62
+ transition: opacity 0.2s;
63
+
64
+ span {
65
+ cursor: pointer;
66
+
67
+ &:hover {
68
+ color: #40a9ff;
69
+ }
70
+ }
71
+ }
72
+
73
+ .thumb:hover .mask {
74
+ opacity: 1;
75
+ }
76
+
77
+ .name {
78
+ width: 104px;
79
+ margin-top: 4px;
80
+ overflow: hidden;
81
+ color: rgba(0, 0, 0, 0.65);
82
+ font-size: 12px;
83
+ line-height: 18px;
84
+ white-space: nowrap;
85
+ text-overflow: ellipsis;
86
+ text-align: center;
87
+ }
88
+
89
+ .error {
90
+ color: #ff4d4f;
91
+ }
92
+
93
+ // 列表模式(picture / text)
94
+ .listItem {
95
+ display: flex;
96
+ align-items: center;
97
+ gap: 8px;
98
+ padding: 4px 8px;
99
+ border-radius: 6px;
100
+
101
+ &:hover {
102
+ background-color: #f5f5f5;
103
+
104
+ .listActions {
105
+ opacity: 1;
106
+ }
107
+ }
108
+ }
109
+
110
+ .listThumb {
111
+ display: flex;
112
+ align-items: center;
113
+ justify-content: center;
114
+ flex: none;
115
+ width: 40px;
116
+ height: 40px;
117
+ overflow: hidden;
118
+ cursor: pointer;
119
+
120
+ img,
121
+ video {
122
+ max-width: 100%;
123
+ max-height: 100%;
124
+ object-fit: contain;
125
+ }
126
+ }
127
+
128
+ .listName {
129
+ flex: auto;
130
+ overflow: hidden;
131
+ color: rgba(0, 0, 0, 0.65);
132
+ font-size: 14px;
133
+ white-space: nowrap;
134
+ text-overflow: ellipsis;
135
+ cursor: pointer;
136
+
137
+ &:hover {
138
+ color: #40a9ff;
139
+ }
140
+ }
141
+
142
+ .listActions {
143
+ display: flex;
144
+ flex: none;
145
+ gap: 12px;
146
+ color: rgba(0, 0, 0, 0.45);
147
+ font-size: 14px;
148
+ opacity: 0;
149
+ transition: opacity 0.2s;
150
+
151
+ span {
152
+ cursor: pointer;
153
+
154
+ &:hover {
155
+ color: #40a9ff;
156
+ }
157
+ }
158
+ }