@fe-free/core 1.3.5 → 1.4.2
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"ahooks": "^3.7.8",
|
|
29
29
|
"axios": "^1.6.5",
|
|
30
30
|
"classnames": "^2.5.1",
|
|
31
|
-
"dayjs": "~1.11.10",
|
|
32
31
|
"lodash-es": "^4.17.21",
|
|
33
32
|
"react-ace": "^11.0.1",
|
|
34
33
|
"react-markdown": "^9.0.1",
|
|
@@ -36,11 +35,12 @@
|
|
|
36
35
|
"react-syntax-highlighter": "^15.5.0",
|
|
37
36
|
"vanilla-jsoneditor": "^0.23.1",
|
|
38
37
|
"zustand": "^4.5.4",
|
|
39
|
-
"@fe-free/tool": "1.
|
|
38
|
+
"@fe-free/tool": "1.4.2"
|
|
40
39
|
},
|
|
41
40
|
"peerDependencies": {
|
|
42
41
|
"@ant-design/pro-components": "^2.8.7",
|
|
43
42
|
"antd": "^5.25.1",
|
|
43
|
+
"dayjs": "~1.11.10",
|
|
44
44
|
"react": "^18.2.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useInfiniteScroll } from 'ahooks';
|
|
2
|
+
import type { Data, InfiniteScrollOptions, Service } from 'ahooks/lib/useInfiniteScroll/types';
|
|
3
|
+
|
|
4
|
+
function useGlobalInfiniteScroll<TData extends Data>(
|
|
5
|
+
service: Service<TData>,
|
|
6
|
+
options?: InfiniteScrollOptions<TData>,
|
|
7
|
+
) {
|
|
8
|
+
return useInfiniteScroll(service, {
|
|
9
|
+
onError: (error) => {
|
|
10
|
+
// 全局抛出错误
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
throw error;
|
|
13
|
+
}, 0);
|
|
14
|
+
},
|
|
15
|
+
...options,
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
__ignore: true,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useGlobalInfiniteScroll };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useRequest } from 'ahooks';
|
|
2
|
+
import type { Options, Plugin, Service } from 'ahooks/es/useRequest/src/types';
|
|
3
|
+
|
|
4
|
+
function useGlobalRequest<TData, TParams extends any[]>(
|
|
5
|
+
service: Service<TData, TParams>,
|
|
6
|
+
options?: Options<TData, TParams>,
|
|
7
|
+
plugins?: Plugin<TData, TParams>[],
|
|
8
|
+
) {
|
|
9
|
+
return useRequest(
|
|
10
|
+
service,
|
|
11
|
+
{
|
|
12
|
+
onError: (error) => {
|
|
13
|
+
// 全局抛出错误
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
throw error;
|
|
16
|
+
}, 0);
|
|
17
|
+
},
|
|
18
|
+
...options,
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
__ignore: true,
|
|
21
|
+
},
|
|
22
|
+
plugins,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { useGlobalRequest };
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { useGlobalInfiniteScroll } from './ahooks/use_global_infinite_scroll';
|
|
2
|
+
export { useGlobalRequest } from './ahooks/use_global_request';
|
|
3
|
+
|
|
1
4
|
export { LoadingButton } from './button';
|
|
2
5
|
|
|
3
6
|
export { CRUD, CRUDDetail, CRUDOfSimple, OperateDelete, useDelete } from './crud';
|
package/src/tailwind.config.js
CHANGED
|
@@ -11,7 +11,6 @@ export const Default = () => {
|
|
|
11
11
|
<span className="text-primary">text-primary</span>
|
|
12
12
|
<span className="text-secondary">text-secondary</span>
|
|
13
13
|
<span className="text-desc">text-desc</span>
|
|
14
|
-
<span className="text-price">text-price</span>
|
|
15
14
|
</div>
|
|
16
15
|
</div>
|
|
17
16
|
);
|