@refinedev/antd 5.36.18 → 5.36.19
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 +6 -0
- package/dist/components/autoSaveIndicator/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/iife/index.js +6 -6
- package/dist/iife/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/autoSaveIndicator/index.tsx +58 -26
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@refinedev/antd",
|
3
|
-
"version": "5.36.
|
3
|
+
"version": "5.36.19",
|
4
4
|
"description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
|
5
5
|
"private": false,
|
6
6
|
"sideEffects": [
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"devDependencies": {
|
29
29
|
"@refinedev/cli": "^2.16.6",
|
30
30
|
"@refinedev/ui-tests": "^1.13.0",
|
31
|
-
"@refinedev/core": "^4.
|
31
|
+
"@refinedev/core": "^4.45.0",
|
32
32
|
"@esbuild-plugins/node-resolve": "^0.1.4",
|
33
33
|
"@testing-library/jest-dom": "^5.16.4",
|
34
34
|
"@testing-library/react": "^13.1.1",
|
@@ -1,5 +1,9 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
AutoSaveIndicatorProps,
|
4
|
+
useTranslate,
|
5
|
+
AutoSaveIndicator as AutoSaveIndicatorCore,
|
6
|
+
} from "@refinedev/core";
|
3
7
|
import { Typography, theme } from "antd";
|
4
8
|
import {
|
5
9
|
EllipsisOutlined,
|
@@ -10,35 +14,63 @@ import {
|
|
10
14
|
|
11
15
|
export const AutoSaveIndicator: React.FC<AutoSaveIndicatorProps> = ({
|
12
16
|
status,
|
17
|
+
elements: {
|
18
|
+
success = (
|
19
|
+
<Message
|
20
|
+
key="autoSave.success"
|
21
|
+
defaultMessage="saved"
|
22
|
+
icon={<CheckCircleOutlined />}
|
23
|
+
/>
|
24
|
+
),
|
25
|
+
error = (
|
26
|
+
<Message
|
27
|
+
key="autoSave.error"
|
28
|
+
defaultMessage="auto save failure"
|
29
|
+
icon={<ExclamationCircleOutlined />}
|
30
|
+
/>
|
31
|
+
),
|
32
|
+
loading = (
|
33
|
+
<Message
|
34
|
+
key="autoSave.loading"
|
35
|
+
defaultMessage="saving..."
|
36
|
+
icon={<SyncOutlined />}
|
37
|
+
/>
|
38
|
+
),
|
39
|
+
idle = (
|
40
|
+
<Message
|
41
|
+
key="autoSave.idle"
|
42
|
+
defaultMessage="waiting for changes"
|
43
|
+
icon={<EllipsisOutlined />}
|
44
|
+
/>
|
45
|
+
),
|
46
|
+
} = {},
|
47
|
+
}) => {
|
48
|
+
return (
|
49
|
+
<AutoSaveIndicatorCore
|
50
|
+
status={status}
|
51
|
+
elements={{
|
52
|
+
success,
|
53
|
+
error,
|
54
|
+
loading,
|
55
|
+
idle,
|
56
|
+
}}
|
57
|
+
/>
|
58
|
+
);
|
59
|
+
};
|
60
|
+
|
61
|
+
const Message = ({
|
62
|
+
key,
|
63
|
+
defaultMessage,
|
64
|
+
icon,
|
65
|
+
}: {
|
66
|
+
key: string;
|
67
|
+
defaultMessage: string;
|
68
|
+
icon: React.ReactNode;
|
13
69
|
}) => {
|
14
70
|
const translate = useTranslate();
|
15
71
|
const { useToken } = theme;
|
16
72
|
const { token } = useToken();
|
17
73
|
|
18
|
-
let message = null;
|
19
|
-
let icon = <EllipsisOutlined />;
|
20
|
-
|
21
|
-
switch (status) {
|
22
|
-
case "success":
|
23
|
-
message = translate("autoSave.success", "saved");
|
24
|
-
icon = <CheckCircleOutlined />;
|
25
|
-
break;
|
26
|
-
case "error":
|
27
|
-
message = translate("autoSave.error", "auto save failure");
|
28
|
-
icon = <ExclamationCircleOutlined />;
|
29
|
-
|
30
|
-
break;
|
31
|
-
case "loading":
|
32
|
-
message = translate("autoSave.loading", "saving...");
|
33
|
-
icon = <SyncOutlined />;
|
34
|
-
|
35
|
-
break;
|
36
|
-
default:
|
37
|
-
// for idle
|
38
|
-
message = translate("autoSave.idle", "waiting for changes");
|
39
|
-
break;
|
40
|
-
}
|
41
|
-
|
42
74
|
return (
|
43
75
|
<Typography.Text
|
44
76
|
style={{
|
@@ -47,7 +79,7 @@ export const AutoSaveIndicator: React.FC<AutoSaveIndicatorProps> = ({
|
|
47
79
|
fontSize: ".8rem",
|
48
80
|
}}
|
49
81
|
>
|
50
|
-
{
|
82
|
+
{translate(key, defaultMessage)}
|
51
83
|
<span style={{ marginLeft: ".2rem" }}>{icon}</span>
|
52
84
|
</Typography.Text>
|
53
85
|
);
|