@refinedev/antd 5.36.6 → 5.36.8
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 +96 -0
- 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/dist/providers/notificationProvider/index.d.ts +5 -0
- package/dist/providers/notificationProvider/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/providers/notificationProvider/index.tsx +56 -5
@@ -1,3 +1,8 @@
|
|
1
1
|
import { NotificationProvider } from "@refinedev/core";
|
2
|
+
/**
|
3
|
+
* @deprecated `notificationProvider` is deprecated due to not being compatible with theme changes in Ant Design. Please use `useNotificationProvider` export as your notification provider.
|
4
|
+
* @see https://refine.dev/docs/api-reference/antd/theming/#usenotificationprovider-compatible-with-theme
|
5
|
+
*/
|
2
6
|
export declare const notificationProvider: NotificationProvider;
|
7
|
+
export declare const useNotificationProvider: () => NotificationProvider;
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/notificationProvider/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/notificationProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAMvD;;;GAGG;AAEH,eAAO,MAAM,oBAAoB,EAAE,oBAkClC,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAO,oBA4C1C,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@refinedev/antd",
|
3
|
-
"version": "5.36.
|
3
|
+
"version": "5.36.8",
|
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": [
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"react-dom": "^17.0.0 || ^18.0.0"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
|
-
"@refinedev/cli": "^2.16.
|
29
|
+
"@refinedev/cli": "^2.16.6",
|
30
30
|
"@refinedev/ui-tests": "^1.13.0",
|
31
31
|
"@refinedev/core": "^4.42.4",
|
32
32
|
"@esbuild-plugins/node-resolve": "^0.1.4",
|
@@ -1,9 +1,14 @@
|
|
1
|
-
import React from "react";
|
2
1
|
import { NotificationProvider } from "@refinedev/core";
|
3
|
-
import { notification } from "antd";
|
2
|
+
import { App, notification as staticNotification } from "antd";
|
3
|
+
import React from "react";
|
4
4
|
|
5
5
|
import { UndoableNotification } from "@components/undoableNotification";
|
6
6
|
|
7
|
+
/**
|
8
|
+
* @deprecated `notificationProvider` is deprecated due to not being compatible with theme changes in Ant Design. Please use `useNotificationProvider` export as your notification provider.
|
9
|
+
* @see https://refine.dev/docs/api-reference/antd/theming/#usenotificationprovider-compatible-with-theme
|
10
|
+
*/
|
11
|
+
|
7
12
|
export const notificationProvider: NotificationProvider = {
|
8
13
|
open: ({
|
9
14
|
key,
|
@@ -14,7 +19,7 @@ export const notificationProvider: NotificationProvider = {
|
|
14
19
|
undoableTimeout,
|
15
20
|
}) => {
|
16
21
|
if (type === "progress") {
|
17
|
-
|
22
|
+
staticNotification.open({
|
18
23
|
key,
|
19
24
|
description: (
|
20
25
|
<UndoableNotification
|
@@ -29,7 +34,7 @@ export const notificationProvider: NotificationProvider = {
|
|
29
34
|
closeIcon: <></>,
|
30
35
|
});
|
31
36
|
} else {
|
32
|
-
|
37
|
+
staticNotification.open({
|
33
38
|
key,
|
34
39
|
description: message,
|
35
40
|
message: description ?? null,
|
@@ -37,5 +42,51 @@ export const notificationProvider: NotificationProvider = {
|
|
37
42
|
});
|
38
43
|
}
|
39
44
|
},
|
40
|
-
close: (key) =>
|
45
|
+
close: (key) => staticNotification.destroy(key),
|
46
|
+
};
|
47
|
+
|
48
|
+
export const useNotificationProvider = (): NotificationProvider => {
|
49
|
+
const { notification: notificationFromContext } = App.useApp();
|
50
|
+
const notification =
|
51
|
+
"open" in notificationFromContext
|
52
|
+
? notificationFromContext
|
53
|
+
: staticNotification;
|
54
|
+
|
55
|
+
const notificationProvider: NotificationProvider = {
|
56
|
+
open: ({
|
57
|
+
key,
|
58
|
+
message,
|
59
|
+
description,
|
60
|
+
type,
|
61
|
+
cancelMutation,
|
62
|
+
undoableTimeout,
|
63
|
+
}) => {
|
64
|
+
if (type === "progress") {
|
65
|
+
notification.open({
|
66
|
+
key,
|
67
|
+
description: (
|
68
|
+
<UndoableNotification
|
69
|
+
notificationKey={key}
|
70
|
+
message={message}
|
71
|
+
cancelMutation={cancelMutation}
|
72
|
+
undoableTimeout={undoableTimeout}
|
73
|
+
/>
|
74
|
+
),
|
75
|
+
message: null,
|
76
|
+
duration: 0,
|
77
|
+
closeIcon: <></>,
|
78
|
+
});
|
79
|
+
} else {
|
80
|
+
notification.open({
|
81
|
+
key,
|
82
|
+
description: message,
|
83
|
+
message: description ?? null,
|
84
|
+
type,
|
85
|
+
});
|
86
|
+
}
|
87
|
+
},
|
88
|
+
close: (key) => notification.destroy(key),
|
89
|
+
};
|
90
|
+
|
91
|
+
return notificationProvider;
|
41
92
|
};
|