@fe-free/core 2.8.10 → 2.8.12
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 +14 -0
- package/package.json +3 -4
- package/src/button/index.tsx +8 -4
- package/src/editor/editor.stories.tsx +2 -2
- package/src/global/error.ts +6 -2
- package/src/route/index.tsx +8 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"classnames": "^2.5.1",
|
|
31
31
|
"file-saver": "^2.0.5",
|
|
32
32
|
"github-markdown-css": "^5.8.1",
|
|
33
|
-
"i": "^0.3.7",
|
|
34
33
|
"localforage": "^1.10.0",
|
|
35
34
|
"lodash-es": "^4.17.21",
|
|
36
35
|
"react-ace": "^11.0.1",
|
|
@@ -42,13 +41,13 @@
|
|
|
42
41
|
"safe-stable-stringify": "^2.5.0",
|
|
43
42
|
"vanilla-jsoneditor": "^0.23.1",
|
|
44
43
|
"zustand": "^4.5.4",
|
|
45
|
-
"@fe-free/tool": "2.8.
|
|
44
|
+
"@fe-free/tool": "2.8.12"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
47
|
"@ant-design/pro-components": "2.8.9",
|
|
49
48
|
"antd": "^5.27.1",
|
|
50
49
|
"dayjs": "~1.11.10",
|
|
51
|
-
"react": "^
|
|
50
|
+
"react": "^19.2.0"
|
|
52
51
|
},
|
|
53
52
|
"scripts": {
|
|
54
53
|
"test": "echo \"Error: no test specified\" && exit 1"
|
package/src/button/index.tsx
CHANGED
|
@@ -9,11 +9,15 @@ function LoadingButton(props: ButtonProps) {
|
|
|
9
9
|
|
|
10
10
|
const handleClick = useCallback(
|
|
11
11
|
(event) => {
|
|
12
|
-
|
|
12
|
+
const result = onClick && onClick(event);
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
setLoading(
|
|
16
|
-
|
|
14
|
+
if (result && typeof (result as Promise<void>).then === 'function') {
|
|
15
|
+
setLoading(true);
|
|
16
|
+
|
|
17
|
+
Promise.resolve(result).finally(() => {
|
|
18
|
+
setLoading(false);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
17
21
|
},
|
|
18
22
|
[onClick],
|
|
19
23
|
);
|
|
@@ -90,10 +90,10 @@ for i in range(10):
|
|
|
90
90
|
render: (props) => <BasicDemo {...props} />,
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
export const
|
|
93
|
+
export const ForJSON: Story = {
|
|
94
94
|
args: {
|
|
95
95
|
language: 'json',
|
|
96
|
-
value:
|
|
96
|
+
value: JSON.stringify({ action: 'hello', data: 'world' }, null, 2),
|
|
97
97
|
},
|
|
98
98
|
render: (props) => <BasicDemo {...props} />,
|
|
99
99
|
};
|
package/src/global/error.ts
CHANGED
|
@@ -71,10 +71,14 @@ function commonHandleError(event) {
|
|
|
71
71
|
// unknown error
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
function initErrorHandle(onError) {
|
|
74
|
+
function initErrorHandle(onError?: (event: ErrorEvent | PromiseRejectionEvent) => void | false) {
|
|
75
75
|
const handleError = (event) => {
|
|
76
|
+
const result = onError?.(event);
|
|
77
|
+
if (result === false) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
commonHandleError(event);
|
|
77
|
-
onError?.(event);
|
|
78
82
|
};
|
|
79
83
|
|
|
80
84
|
window.addEventListener('error', handleError);
|
package/src/route/index.tsx
CHANGED
|
@@ -68,9 +68,14 @@ const routeTool = {
|
|
|
68
68
|
}) => {
|
|
69
69
|
const sp = new URLSearchParams(searchParams);
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
try {
|
|
72
|
+
routeTool.getNavigate()(
|
|
73
|
+
`${generatePath(path, params)}${searchParams ? `?${sp.toString()}` : ''}`,
|
|
74
|
+
);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
console.log('routeTool.navigateTo generatePath error', path, params);
|
|
77
|
+
console.log(e);
|
|
78
|
+
}
|
|
74
79
|
},
|
|
75
80
|
};
|
|
76
81
|
|