Skip to content
This repository was archived by the owner on Aug 4, 2022. It is now read-only.

Commit 315d2dc

Browse files
committed
重写 useList 方法
1 parent ff47cb8 commit 315d2dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+8676
-1107
lines changed

.vscode/settings.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"**/.tsbuildinfo": true,
1010
"**/.tsbuildinfo.*": true,
1111
"**/.history": true,
12-
"**/build/**": true
12+
"**/build/**": true,
13+
"**/yarn.lock": true,
14+
"**/package.json": true
1315
},
1416
"files.autoSave": "afterDelay",
1517
"files.autoSaveDelay": 1500,
@@ -25,7 +27,7 @@
2527
"**/build/**": true
2628
},
2729
"editor.minimap.enabled": false,
28-
"cSpell.words": ["devtools"],
30+
"cSpell.words": ["antd", "devtools"],
2931
"cSpell.ignoreWords": ["tslib"],
3032
"cSpell.ignorePaths": [".history", ".vscode", "build", "package-lock.json", "yarn.lock"]
3133
}

README.md

+5-30
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,22 @@
1-
# react-app
1+
# react-snowpack-app
22

33
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
44

5-
## 目录结构
6-
7-
```text
8-
Project/
9-
├── README.md
10-
├── package.json
11-
├── tsconfig.json
12-
├── babel.config.json
13-
├── snowpack.config.js
14-
├── public/
15-
└── src/
16-
├── components/
17-
├── hooks/
18-
├── lib/
19-
├── mocks/
20-
├── models/
21-
├── services/
22-
├── store/
23-
├── styles/
24-
├── views/
25-
├── App.tsx
26-
├── index.tsx
27-
└── router.tsx
28-
```
29-
305
## 开发步骤
316

32-
你需要安装 Node.js 的版本为 6+.
7+
你需要安装 Node.js 的版本为 12+.
338

349
克隆此仓库后运行:
3510

3611
```bash
3712
# 安装依赖
38-
$ npm install
13+
$ yarn install
3914

4015
# 本地开发
41-
$ npm run dev
16+
$ yarn dev
4217

4318
# 构建代码
44-
$ npm run build
19+
$ yarn build
4520
```
4621

4722
在 package.json 文件的 scripts 部分还有一些其他脚本可用.

babel.config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"extends": "@snowpack/app-scripts-react/babel.config.json"
2+
"extends": "@snowpack/app-scripts-react/babel.config.json",
3+
"plugins": ["@babel/plugin-proposal-class-properties", "transform-async-to-promises"]
34
}

package.json

+13-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"dev": "snowpack dev",
77
"build": "snowpack build",
88
"test": "jest",
9-
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json}\"",
10-
"lint": "prettier --check \"**/*.{js,jsx,ts,tsx,json}\""
9+
"format": "prettier --write \"**/*.{js,less,css,ts,tsx,json}\"",
10+
"lint": "prettier --check \"**/*.{js,ts,less,css,tsx,json}\""
1111
},
1212
"gitHooks": {
1313
"pre-commit": "lint-staged"
@@ -19,17 +19,20 @@
1919
]
2020
},
2121
"dependencies": {
22+
"@ant-design/icons": "^4.2.2",
23+
"antd": "^4.6.6",
2224
"axios": "^0.19.2",
25+
"dayjs": "^1.9.1",
2326
"lodash-es": "^4.17.15",
2427
"react": "^16.13.0",
2528
"react-dom": "^16.13.0",
26-
"react-redux": "^7.2.0",
29+
"react-redux": "^7.2.1",
2730
"react-router-config": "^5.1.1",
2831
"react-router-dom": "^5.2.0",
29-
"redux": "^4.0.5",
30-
"tslib": "^2.0.0"
32+
"redux": "^4.0.5"
3133
},
3234
"devDependencies": {
35+
"@babel/plugin-proposal-class-properties": "^7.10.4",
3336
"@snowpack/app-scripts-react": "^1.2.0",
3437
"@testing-library/jest-dom": "^5.5.0",
3538
"@testing-library/react": "^10.0.3",
@@ -39,13 +42,17 @@
3942
"@types/react-redux": "^7.1.9",
4043
"@types/react-router-config": "^5.0.1",
4144
"@types/react-router-dom": "^5.1.5",
45+
"@yinxulai/rollup-plugin-less": "^0.0.7",
4246
"babel-plugin-transform-async-to-promises": "^0.8.15",
4347
"better-mock": "^0.2.5",
4448
"jest": "^25.4.0",
49+
"joi": "^17.2.1",
50+
"less": "^3.12.2",
4551
"lint-staged": "^10.2.11",
46-
"node-sass": "^4.14.1",
52+
"path-to-regexp": "^6.1.0",
4753
"prettier": "^2.0.0",
4854
"snowpack": "^2.5.0",
55+
"snowpack-plugin-less": "^1.0.3",
4956
"typescript": "^3.8.0",
5057
"yorkie": "^2.0.0"
5158
},

public/index.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
</head>
2222
<body>
2323
<noscript>You need to enable JavaScript to run this app.</noscript>
24-
<div id="root"></div>
24+
<div id="root">
25+
<div>Loading...</div>
26+
</div>
2527
<script type="module" src="/_dist_/index.js"></script>
2628
</body>
2729
</html>

snowpack.config.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1+
const less = require('@yinxulai/rollup-plugin-less')
2+
13
module.exports = {
24
extends: '@snowpack/app-scripts-react',
3-
scripts: {},
4-
plugins: [],
5+
installOptions: {
6+
rollup: {
7+
plugins: [
8+
less({
9+
lessOptions: {
10+
javascriptEnabled: true,
11+
},
12+
}),
13+
],
14+
},
15+
},
16+
devOptions: {
17+
port: 3000,
18+
open: 'none',
19+
bundle: false,
20+
},
521
}

src/App.tsx

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
import React, { FC } from 'react'
1+
import React, { FC, Suspense } from 'react'
22
import { Provider } from 'react-redux'
33

4+
import { ConfigProvider } from 'antd'
5+
import zhCN from 'antd/es/locale/zh_CN'
6+
47
import store from './store/index'
58
import { RouterView } from './router'
69

710
export type AppState = {}
811

912
const App: FC = () => (
10-
<Provider store={store}>
11-
<RouterView />
12-
</Provider>
13+
<React.StrictMode>
14+
<Provider store={store}>
15+
<ConfigProvider locale={zhCN}>
16+
<Suspense fallback={() => <div>Loading</div>}>
17+
<RouterView />
18+
</Suspense>
19+
</ConfigProvider>
20+
</Provider>
21+
</React.StrictMode>
1322
)
1423

1524
export default App

src/biz/components/biz-category-select.tsx

-42
This file was deleted.

src/biz/components/biz-me.tsx

-48
This file was deleted.

src/biz/models/access.ts

-4
This file was deleted.

src/biz/models/bill.ts

-6
This file was deleted.

src/biz/models/category.ts

-5
This file was deleted.

src/biz/services/bill.ts

-8
This file was deleted.

src/components/Calendar.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import 'antd/es/calendar/style'
2+
3+
import type { Dayjs } from 'dayjs'
4+
5+
import DayjsConfig from 'rc-picker/lib/generate/dayjs'
6+
import withCalendar from 'antd/es/calendar/generateCalendar'
7+
8+
const Calendar = withCalendar<Dayjs>(DayjsConfig)
9+
10+
export default Calendar

src/components/DatePicker.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'antd/es/date-picker/style/index'
2+
3+
import type { Dayjs } from 'dayjs'
4+
5+
import DayjsConfig from 'rc-picker/lib/generate/dayjs'
6+
import withDatePicker from 'antd/es/date-picker/generatePicker'
7+
8+
const DatePicker = withDatePicker<Dayjs>(DayjsConfig)
9+
10+
DatePicker.displayName = 'DatePicker'
11+
12+
export default DatePicker

src/components/TimePicker.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react'
2+
3+
import type { Dayjs } from 'dayjs'
4+
import type { Omit } from 'antd/es/_util/type'
5+
6+
import DatePicker from './DatePicker'
7+
import type { PickerTimeProps } from 'antd/es/date-picker/generatePicker'
8+
9+
export interface TimePickerProps extends Omit<PickerTimeProps<Dayjs>, 'picker'> {}
10+
11+
const TimePicker = React.forwardRef<any, TimePickerProps>((props, ref) => {
12+
return <DatePicker {...props} picker="time" mode={undefined} ref={ref} />
13+
})
14+
15+
TimePicker.displayName = 'TimePicker'
16+
17+
export default TimePicker

src/components/ui-select.tsx

-41
This file was deleted.

0 commit comments

Comments
 (0)