Skip to content

Commit 88fb0d4

Browse files
committed
fix: src/hooks->app hooks
1 parent ee689b8 commit 88fb0d4

40 files changed

+994
-777
lines changed

.github/workflows/deploy-gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
id-token: write
1313

1414
concurrency:
15-
group: "pages"
15+
group: 'pages'
1616
cancel-in-progress: false
1717

1818
jobs:

.storybook/main.ts

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
1-
2-
import type { StorybookConfig } from '@storybook/react-webpack5';
3-
import path from 'path';
4-
const rootDir = process.cwd();
1+
import type { StorybookConfig } from '@storybook/react-webpack5'
2+
import path from 'path'
3+
const rootDir = process.cwd()
54
const config: StorybookConfig = {
6-
"stories": [
7-
"../src/**/*.mdx",
8-
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
9-
],
10-
"addons": [
11-
"@storybook/addon-webpack5-compiler-swc",
12-
"@storybook/addon-a11y",
13-
"@storybook/addon-docs",
14-
"@storybook/addon-onboarding"
5+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
6+
addons: [
7+
'@storybook/addon-webpack5-compiler-swc',
8+
'@storybook/addon-a11y',
9+
'@storybook/addon-docs',
10+
'@storybook/addon-onboarding',
1511
],
16-
"framework": "@storybook/react-webpack5",
12+
framework: '@storybook/react-webpack5',
1713
webpackFinal: async (config) => {
18-
config.resolve = config.resolve || {};
14+
config.resolve = config.resolve || {}
1915
config.resolve.alias = {
2016
...(config.resolve.alias || {}),
2117
'@': path.resolve(rootDir, 'src'),
22-
"@src/*": path.resolve(rootDir, 'src/*'),
23-
"@stateless/*": path.resolve(rootDir, "src/components/stateless/*"),
24-
"@stateful/*": path.resolve(rootDir, "src/components/stateful/*"),
25-
"@hooks/*": path.resolve(rootDir, "src/components/hooks/*"),
26-
"@container/*": path.resolve(rootDir, "src/components/container/*"),
27-
"@assets/*": path.resolve(rootDir, "src/assets/*"),
28-
"@pages/*": path.resolve(rootDir, "src/pages/*"),
29-
"@routers/*": path.resolve(rootDir, "src/routers/*"),
30-
"@utils/*": path.resolve(rootDir, "src/utils/*"),
31-
"@theme/*": path.resolve(rootDir, "src/theme/*")
32-
};
18+
'@src/*': path.resolve(rootDir, 'src/*'),
19+
'@stateless/*': path.resolve(rootDir, 'src/components/stateless/*'),
20+
'@stateful/*': path.resolve(rootDir, 'src/components/stateful/*'),
21+
'@hooks/*': path.resolve(rootDir, 'src/components/hooks/*'),
22+
'@container/*': path.resolve(rootDir, 'src/components/container/*'),
23+
'@assets/*': path.resolve(rootDir, 'src/assets/*'),
24+
'@pages/*': path.resolve(rootDir, 'src/pages/*'),
25+
'@routers/*': path.resolve(rootDir, 'src/routers/*'),
26+
'@utils/*': path.resolve(rootDir, 'src/utils/*'),
27+
'@theme/*': path.resolve(rootDir, 'src/theme/*'),
28+
}
3329
// If building for a subpath (e.g. /pro-react-admin/storybook/)
3430
// you can set the STORYBOOK_BASE_HREF env var when running the build.
3531
// This will make webpack emit assets with the correct publicPath.
@@ -41,7 +37,7 @@ const config: StorybookConfig = {
4137
// config.output.publicPath = baseHref.endsWith('/') ? baseHref : baseHref + '/';
4238
// }
4339

44-
return config;
40+
return config
4541
},
46-
};
47-
export default config;
42+
}
43+
export default config

.storybook/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ const preview: Preview = {
99
},
1010
},
1111
},
12-
};
12+
}
1313

14-
export default preview;
14+
export default preview

.storybook/preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { MemoryRouter } from 'react-router-dom'
55
const preview: Preview = {
66
decorators: [
77
(Story) => (
8-
<MemoryRouter initialEntries={["/"]}>
8+
<MemoryRouter initialEntries={['/']}>
99
<Story />
1010
</MemoryRouter>
1111
),

CHANGELOG.md

Lines changed: 171 additions & 175 deletions
Large diffs are not rendered by default.

NPM_README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,42 @@ pnpm add @w.ui/wui-react
2424
## 🔨 使用
2525

2626
```jsx
27-
import React from 'react';
28-
import { DescBox, RadioInput, Exception } from '@w.ui/wui-react';
29-
import '@w.ui/wui-react/style.css';
27+
import React from 'react'
28+
import { DescBox, RadioInput, Exception } from '@w.ui/wui-react'
29+
import '@w.ui/wui-react/style.css'
3030

3131
const App = () => {
3232
return (
3333
<div>
3434
<DescBox title="示例标题" description="这是一个描述框组件" />
35-
<RadioInput
35+
<RadioInput
3636
options={[
3737
{ label: '选项1', value: '1' },
38-
{ label: '选项2', value: '2' }
38+
{ label: '选项2', value: '2' },
3939
]}
4040
onChange={(value) => console.log(value)}
4141
/>
4242
</div>
43-
);
44-
};
43+
)
44+
}
4545

46-
export default App;
46+
export default App
4747
```
4848

4949
## 📚 组件列表
5050

5151
本库包含 100+ 组件,包括但不限于:
5252

5353
### 核心组件
54+
5455
- ErrorBoundary - 错误边界
5556
- WatermarkProvider - 水印
5657
- KeepAlive - 页面缓存
5758
- ResponsiveTable - 响应式表格
5859
- GlobalSearch - 全局搜索
5960

6061
### UI 组件
62+
6163
- AdvancedCodeBlock - 高级代码块
6264
- AnimatedList - 动画列表
6365
- BackgroundBeams - 背景光束效果
@@ -67,6 +69,7 @@ export default App;
6769
- RadioInput - 单选/多选输入
6870

6971
### 动画组件
72+
7073
- AnimateOnScreen - 进入视口动画
7174
- AnimateRipple - 波纹动画
7275
- BlurFade - 模糊渐显
@@ -116,6 +119,7 @@ MIT © [wkylin](https://github.com/wkylin)
116119
## 👨‍💻 作者
117120

118121
**wkylin**
122+
119123
- GitHub: [@wkylin](https://github.com/wkylin)
120124
121125

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
---
4040

41-
4241
## 🔑 核心功能
4342

4443
- 🔐 **动态权限引擎**:登录后根据角色(Admin/Manager/Business/User)自动生成路由表,非权限路由自动拦截(403/404)。
@@ -157,6 +156,7 @@ Apache-2.0 © [wkylin](https://github.com/wkylin)
157156
---
158157

159158
## 🌐 约定式提交
159+
160160
1. [约定式提交](https://www.conventionalcommits.org/zh-hans/v1.0.0/)
161161
2. [语义化版本 2.0.0](https://semver.org/lang/zh-CN/)
162162

@@ -169,6 +169,7 @@ Apache-2.0 © [wkylin](https://github.com/wkylin)
169169
---
170170

171171
## 🦄 脚手架--白泽 baize
172+
172173
> **白泽**,中国古代神话中的瑞兽。能言语,通万物之情,知鬼神之事,“王者有德”才出现,能辟除人间一切邪气,可令人逢凶化吉。
173174
>
174175
> 本项目取名"白泽",寓意作为开发者的瑞兽,帮助您辟除配置烦恼,逢凶化吉,快速启动高质量项目。
@@ -179,15 +180,14 @@ Baize CLI 是一个轻量、规范且高效的前端项目脚手架工具,旨
179180
🛠 规范集成:内置 ESLint、Prettier 等代码规范配置。
180181
🎨 交互友好:优雅的命令行交互体验。
181182

182-
```bash
183-
> npm install -g baize-cli
184-
> baize
185-
```
183+
```bash
184+
> npm install -g baize-cli
185+
> baize
186+
```
186187

187-
Npm: [Baize](https://www.npmjs.com/package/baize-cli)
188-
---
188+
## Npm: [Baize](https://www.npmjs.com/package/baize-cli)
189189

190-
## 🔍 自动化持续代码审查工具
190+
## 🔍 自动化持续代码审查工具
191191

192192
1. [DeepSource/](https://deepsource.io/)
193193
2. [DeepScan](https://deepscan.io/)
@@ -300,9 +300,9 @@ Npm: [Baize](https://www.npmjs.com/package/baize-cli)
300300
301301
## 🌳 Tree Node Cli
302302
303-
1. npm install -g tree-node-cli
304-
2. Mac: tree -L 2 -I "node_modules" -r -F
305-
3. Win: treee -L 2 -I "node_modules" -r -F
303+
1. npm install -g tree-node-cli
304+
2. Mac: tree -L 2 -I "node_modules" -r -F
305+
3. Win: treee -L 2 -I "node_modules" -r -F
306306
307307
---
308308
@@ -316,16 +316,15 @@ Npm: [Baize](https://www.npmjs.com/package/baize-cli)
316316
317317
2. 依赖分析
318318
319-
```bash
320-
1. npm run js-analyzer
321-
2. "standard": "standard src/\*_/_",
322-
3. "standard:fix": "standard --fix src/\*_/_",
323-
4. rm -rf package-lock.json
324-
```
319+
```bash
320+
1. npm run js-analyzer
321+
2. "standard": "standard src/\*_/_",
322+
3. "standard:fix": "standard --fix src/\*_/_",
323+
4. rm -rf package-lock.json
324+
```
325325
326326
---
327327
328-
329328
## 🚀 GitHub Proxy
330329
331330
1. 首先确认自己 git 拉取代码的方式
@@ -361,6 +360,7 @@ Npm: [Baize](https://www.npmjs.com/package/baize-cli)
361360
git config --global --unset http.proxy
362361
git config --global --unset https.proxy
363362
```
363+
364364
## 🤝 Show your support
365365
366366
<!-- Give a ⭐️ if this project helped you! -->

api/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function postToGitHubToken({ code, redirect_uri, client_id, client_secret }) {
4747
'Content-Type': 'application/x-www-form-urlencoded',
4848
'Content-Length': Buffer.byteLength(postData),
4949
Accept: 'application/json',
50-
'User-Agent': 'pro-react-admin-server'
50+
'User-Agent': 'pro-react-admin-server',
5151
},
5252
}
5353

docs/FETCH_REQUESTS.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ await http.upload('/api/upload', formData)
5555
await http.download('/api/export', { id: 123 }, 'report.xlsx', {
5656
onProgress: ({ percent, loaded, total }) => {
5757
console.log(`下载进度: ${percent}%`)
58-
}
58+
},
5959
})
6060
```
6161

@@ -65,7 +65,7 @@ await http.download('/api/export', { id: 123 }, 'report.xlsx', {
6565

6666
```javascript
6767
// 请求拦截器
68-
http.useRequestInterceptor(config => {
68+
http.useRequestInterceptor((config) => {
6969
config.headers['Authorization'] = 'Bearer token'
7070
return config
7171
})
@@ -86,10 +86,7 @@ await http.retry(() => http.get('/api/unstable'), 3, 1000)
8686
**并发请求**:
8787

8888
```javascript
89-
const [user, posts] = await http.parallel([
90-
{ url: '/api/user/1' },
91-
{ url: '/api/user/1/posts' }
92-
])
89+
const [user, posts] = await http.parallel([{ url: '/api/user/1' }, { url: '/api/user/1/posts' }])
9390
```
9491

9592
**取消请求**:
@@ -105,9 +102,13 @@ controller.abort() // 取消请求
105102
默认情况下,`GET``DELETE` 请求会自动添加时间戳参数 `_` 以防止缓存。如果不需要此行为,可手动禁用。
106103

107104
```javascript
108-
await http.get('/api/static-data', {}, {
109-
addTimestamp: false // 禁用自动添加时间戳
110-
})
105+
await http.get(
106+
'/api/static-data',
107+
{},
108+
{
109+
addTimestamp: false, // 禁用自动添加时间戳
110+
}
111+
)
111112
```
112113

113114
---
@@ -121,17 +122,17 @@ await http.get('/api/static-data', {}, {
121122
```javascript
122123
const [data, loading, error, refetch] = useRequest('/api/data', {
123124
method: 'GET',
124-
params: { id: 1 }
125+
params: { id: 1 },
125126
})
126127
```
127128

128129
### 2. 快捷 Hooks
129130

130-
* `useGet(url, options)` - GET 请求
131-
* `usePost(url, options)` - POST 请求
132-
* `usePut(url, options)` - PUT 请求
133-
* `useDelete(url, options)` - DELETE 请求
134-
* `usePatch(url, options)` - PATCH 请求
131+
- `useGet(url, options)` - GET 请求
132+
- `usePost(url, options)` - POST 请求
133+
- `usePut(url, options)` - PUT 请求
134+
- `useDelete(url, options)` - DELETE 请求
135+
- `usePatch(url, options)` - PATCH 请求
135136

136137
**示例**:
137138

@@ -164,15 +165,17 @@ const UserProfile = ({ id }) => {
164165
## 四、API 参考
165166

166167
### FetchClient 配置 (Config)
167-
| 属性 | 类型 | 默认值 | 说明 |
168-
|---|---|---|---|
169-
| `BASE_URL` | string | `process.env.APP_BASE_URL` | 基础 URL |
170-
| `TIMEOUT` | number | `20000` | 超时时间 (ms) |
171-
| `HEADERS` | object | `{'Content-Type': 'application/json'}` | 默认请求头 |
172-
| `isShowError` | boolean | `true` | 请求失败时是否自动弹出错误提示 |
173-
| `addTimestamp` | boolean | `true` | 是否为 GET/DELETE 请求自动添加时间戳后缀 |
168+
169+
| 属性 | 类型 | 默认值 | 说明 |
170+
| -------------- | ------- | -------------------------------------- | ---------------------------------------- |
171+
| `BASE_URL` | string | `process.env.APP_BASE_URL` | 基础 URL |
172+
| `TIMEOUT` | number | `20000` | 超时时间 (ms) |
173+
| `HEADERS` | object | `{'Content-Type': 'application/json'}` | 默认请求头 |
174+
| `isShowError` | boolean | `true` | 请求失败时是否自动弹出错误提示 |
175+
| `addTimestamp` | boolean | `true` | 是否为 GET/DELETE 请求自动添加时间戳后缀 |
174176

175177
### http 实例方法
178+
176179
- `request(url, options)`
177180
- `get(url, params, config)`
178181
- `post(url, payload, config)`

0 commit comments

Comments
 (0)