@wangtaizong/components 1.0.7 → 1.1.0
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/dist/index.js +285 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/es/Button/index.d.ts +9 -0
- package/es/Button/index.js +25 -0
- package/es/Icon/index.d.ts +9 -0
- package/es/Icon/index.js +25 -0
- package/es/Upload/index.d.ts +16 -0
- package/es/Upload/index.js +221 -0
- package/es/antd/index.js +2 -0
- package/es/index.js +5 -0
- package/lib/Button/index.d.ts +9 -0
- package/lib/Button/index.js +29 -0
- package/lib/Icon/index.d.ts +9 -0
- package/lib/Icon/index.js +48 -0
- package/lib/Upload/index.d.ts +16 -0
- package/lib/Upload/index.js +243 -0
- package/lib/antd/index.d.ts +2 -0
- package/lib/antd/index.js +28 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +32 -0
- package/package.json +40 -68
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.dumirc.ts +0 -28
- package/.editorconfig +0 -13
- package/.eslintrc.js +0 -3
- package/.husky/commit-msg +0 -5
- package/.husky/pre-commit +0 -8
- package/.husky/pre-push +0 -8
- package/.prettierignore +0 -2
- package/.prettierrc.js +0 -19
- package/.stylelintrc +0 -3
- package/.vscode/settings.json +0 -3
- package/README.md +0 -0
- package/commitlint.config.js +0 -21
- package/docs/changelogs/index.md +0 -9
- package/docs/components/index.md +0 -1
- package/docs/guide/install.md +0 -39
- package/docs/index.md +0 -21
- package/docs/utils/index.md +0 -1
- package/lerna.json +0 -8
- package/packages/components/CHANGELOG.md +0 -0
- package/packages/components/package.json +0 -48
- package/packages/components/rollup.config.mjs +0 -108
- package/packages/components/src/Button/index.md +0 -13
- package/packages/components/src/Button/index.tsx +0 -34
- package/packages/components/src/Icon/index.md +0 -81
- package/packages/components/src/Icon/index.tsx +0 -34
- package/packages/components/src/Upload/index.md +0 -209
- package/packages/components/src/Upload/index.tsx +0 -218
- package/packages/components/src/antd/index.md +0 -12
- package/packages/components/src/index.md +0 -23
- package/packages/components/tsconfig.json +0 -32
- package/packages/utils/README.md +0 -11
- package/packages/utils/package.json +0 -35
- package/packages/utils/rollup.config.mjs +0 -63
- package/packages/utils/src/CHRRequest/index.md +0 -59
- package/packages/utils/src/CHRRequest/index.ts +0 -94
- package/packages/utils/src/index.ts +0 -17
- package/packages/utils/tsconfig.json +0 -28
- package/pnpm-workspace.yaml +0 -8
- package/public/favicon.ico +0 -0
- package/public/logo.webp +0 -0
- package/tsconfig.json +0 -14
- /package/{packages/components/src/antd/index.tsx → es/antd/index.d.ts} +0 -0
- /package/{packages/components/src/index.ts → es/index.d.ts} +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { createAlova, RequestBody } from 'alova';
|
|
2
|
-
import { useRequest } from 'alova/client';
|
|
3
|
-
import adapterFetch from 'alova/fetch';
|
|
4
|
-
import ReactHook from 'alova/react';
|
|
5
|
-
const getToken = () => localStorage.getItem('token');
|
|
6
|
-
|
|
7
|
-
export interface AlovaClientOptions {
|
|
8
|
-
baseURL: string;
|
|
9
|
-
timeout?: number;
|
|
10
|
-
cacheFor?: any;
|
|
11
|
-
beforeRequest?: (method: any) => void;
|
|
12
|
-
responded?: any;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class AlovaClient {
|
|
16
|
-
private instance: ReturnType<typeof createAlova>;
|
|
17
|
-
|
|
18
|
-
constructor(options: AlovaClientOptions) {
|
|
19
|
-
const {
|
|
20
|
-
baseURL,
|
|
21
|
-
timeout = 10000,
|
|
22
|
-
cacheFor = { GET: 2000 },
|
|
23
|
-
beforeRequest,
|
|
24
|
-
responded,
|
|
25
|
-
} = options;
|
|
26
|
-
this.instance = createAlova({
|
|
27
|
-
baseURL,
|
|
28
|
-
statesHook: ReactHook,
|
|
29
|
-
requestAdapter: adapterFetch(),
|
|
30
|
-
timeout,
|
|
31
|
-
cacheFor,
|
|
32
|
-
beforeRequest: (method) => {
|
|
33
|
-
method.config.headers = method.config.headers || {};
|
|
34
|
-
method.config.headers['Content-Type'] =
|
|
35
|
-
'application/json;charset=utf-8';
|
|
36
|
-
|
|
37
|
-
if (beforeRequest) {
|
|
38
|
-
beforeRequest(method);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (method.meta?.ignoreAuth) return;
|
|
43
|
-
const token = getToken();
|
|
44
|
-
if (token) {
|
|
45
|
-
method.config.headers['Authorization'] = `Bearer ${token}`;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
responded: responded || {
|
|
49
|
-
onSuccess: async (response) => {
|
|
50
|
-
const json = await response.json();
|
|
51
|
-
if (response.status !== 200) {
|
|
52
|
-
// antd.message.error(json.msg || '请求失败');
|
|
53
|
-
return Promise.reject(json.message || '请求失败');
|
|
54
|
-
}
|
|
55
|
-
return Promise.resolve(json);
|
|
56
|
-
},
|
|
57
|
-
onError: async (error) => {
|
|
58
|
-
// antd.message.error(error.message);
|
|
59
|
-
return Promise.reject(error);
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
}) as any;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get<T = any>(url: string, config?: RequestInit) {
|
|
66
|
-
return this.instance.Get<T>(url, config);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
post<T = any>(url: string, data?: RequestBody, config?: RequestInit) {
|
|
70
|
-
return this.instance.Post<T>(url, data, config);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
put<T = any>(url: string, data?: RequestBody, config?: RequestInit) {
|
|
74
|
-
return this.instance.Put<T>(url, data, config);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
delete<T = any>(url: string, data?: RequestBody, config?: RequestInit) {
|
|
78
|
-
return this.instance.Delete<T>(url, data, config);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getInstance() {
|
|
82
|
-
return this.instance;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const defaultBaseURL = 'http://localhost:3000';
|
|
87
|
-
const defaultClient = new AlovaClient({ baseURL: defaultBaseURL });
|
|
88
|
-
|
|
89
|
-
export const alovaGet = defaultClient.get.bind(defaultClient);
|
|
90
|
-
export const alovaPost = defaultClient.post.bind(defaultClient);
|
|
91
|
-
export const alovaPut = defaultClient.put.bind(defaultClient);
|
|
92
|
-
export const alovaDelete = defaultClient.delete.bind(defaultClient);
|
|
93
|
-
export { AlovaClient, useRequest };
|
|
94
|
-
export default defaultClient;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES5",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"baseUrl": ".",
|
|
7
|
-
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"jsxImportSource": "react",
|
|
10
|
-
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"types": ["react", "react-dom"],
|
|
13
|
-
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noImplicitAny": false,
|
|
16
|
-
"forceConsistentCasingInFileNames": true,
|
|
17
|
-
|
|
18
|
-
"esModuleInterop": true,
|
|
19
|
-
"allowSyntheticDefaultImports": true,
|
|
20
|
-
|
|
21
|
-
"sourceMap": true,
|
|
22
|
-
"inlineSources": true
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
/* 文件范围控制 */
|
|
26
|
-
"include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*.d.ts"],
|
|
27
|
-
"exclude": ["node_modules", "dist", "**/__tests__/*"]
|
|
28
|
-
}
|
package/pnpm-workspace.yaml
DELETED
package/public/favicon.ico
DELETED
|
Binary file
|
package/public/logo.webp
DELETED
|
Binary file
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"sourceMap": true,
|
|
4
|
-
"strict": true,
|
|
5
|
-
"noImplicitAny": true,
|
|
6
|
-
"baseUrl": ".",
|
|
7
|
-
"paths": {
|
|
8
|
-
"@kc-components/*": ["packages/*/src"]
|
|
9
|
-
},
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"experimentalDecorators": true
|
|
12
|
-
},
|
|
13
|
-
"include": [".dumirc.ts", "packages/**/*.{ts,tsx}"]
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|