@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.
Files changed (68) hide show
  1. package/dist/index.js +285 -0
  2. package/dist/index.js.map +1 -0
  3. package/dist/index.min.js +2 -0
  4. package/dist/index.min.js.map +1 -0
  5. package/es/Button/index.d.ts +9 -0
  6. package/es/Button/index.js +25 -0
  7. package/es/Icon/index.d.ts +9 -0
  8. package/es/Icon/index.js +25 -0
  9. package/es/Upload/index.d.ts +16 -0
  10. package/es/Upload/index.js +221 -0
  11. package/es/antd/index.js +2 -0
  12. package/es/index.js +5 -0
  13. package/lib/Button/index.d.ts +9 -0
  14. package/lib/Button/index.js +29 -0
  15. package/lib/Icon/index.d.ts +9 -0
  16. package/lib/Icon/index.js +48 -0
  17. package/lib/Upload/index.d.ts +16 -0
  18. package/lib/Upload/index.js +243 -0
  19. package/lib/antd/index.d.ts +2 -0
  20. package/lib/antd/index.js +28 -0
  21. package/lib/index.d.ts +5 -0
  22. package/lib/index.js +32 -0
  23. package/package.json +40 -68
  24. package/.changeset/README.md +0 -8
  25. package/.changeset/config.json +0 -11
  26. package/.dumirc.ts +0 -28
  27. package/.editorconfig +0 -13
  28. package/.eslintrc.js +0 -3
  29. package/.husky/commit-msg +0 -5
  30. package/.husky/pre-commit +0 -8
  31. package/.husky/pre-push +0 -8
  32. package/.prettierignore +0 -2
  33. package/.prettierrc.js +0 -19
  34. package/.stylelintrc +0 -3
  35. package/.vscode/settings.json +0 -3
  36. package/README.md +0 -0
  37. package/commitlint.config.js +0 -21
  38. package/docs/changelogs/index.md +0 -9
  39. package/docs/components/index.md +0 -1
  40. package/docs/guide/install.md +0 -39
  41. package/docs/index.md +0 -21
  42. package/docs/utils/index.md +0 -1
  43. package/lerna.json +0 -8
  44. package/packages/components/CHANGELOG.md +0 -0
  45. package/packages/components/package.json +0 -48
  46. package/packages/components/rollup.config.mjs +0 -108
  47. package/packages/components/src/Button/index.md +0 -13
  48. package/packages/components/src/Button/index.tsx +0 -34
  49. package/packages/components/src/Icon/index.md +0 -81
  50. package/packages/components/src/Icon/index.tsx +0 -34
  51. package/packages/components/src/Upload/index.md +0 -209
  52. package/packages/components/src/Upload/index.tsx +0 -218
  53. package/packages/components/src/antd/index.md +0 -12
  54. package/packages/components/src/index.md +0 -23
  55. package/packages/components/tsconfig.json +0 -32
  56. package/packages/utils/README.md +0 -11
  57. package/packages/utils/package.json +0 -35
  58. package/packages/utils/rollup.config.mjs +0 -63
  59. package/packages/utils/src/CHRRequest/index.md +0 -59
  60. package/packages/utils/src/CHRRequest/index.ts +0 -94
  61. package/packages/utils/src/index.ts +0 -17
  62. package/packages/utils/tsconfig.json +0 -28
  63. package/pnpm-workspace.yaml +0 -8
  64. package/public/favicon.ico +0 -0
  65. package/public/logo.webp +0 -0
  66. package/tsconfig.json +0 -14
  67. /package/{packages/components/src/antd/index.tsx → es/antd/index.d.ts} +0 -0
  68. /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,17 +0,0 @@
1
- import CHRRequest, {
2
- AlovaClient,
3
- alovaDelete,
4
- alovaGet,
5
- alovaPost,
6
- alovaPut,
7
- useRequest,
8
- } from './CHRRequest';
9
- export {
10
- AlovaClient,
11
- alovaDelete,
12
- alovaGet,
13
- alovaPost,
14
- alovaPut,
15
- CHRRequest,
16
- useRequest,
17
- };
@@ -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
- }
@@ -1,8 +0,0 @@
1
- packages:
2
- - 'packages/*'
3
-
4
- catalog:
5
- react: ^18.3.1
6
- react-dom: ^18.3.1
7
- antd: ^6.3.3
8
- alova: 3.5.1
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
- }