@refinedev/antd 5.26.0 → 5.27.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.
- package/CHANGELOG.md +19 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/components/buttons/list/index.d.ts.map +1 -1
- package/dist/components/crud/create/index.d.ts.map +1 -1
- package/dist/components/crud/edit/index.d.ts.map +1 -1
- package/dist/components/crud/list/index.d.ts.map +1 -1
- package/dist/components/crud/show/index.d.ts.map +1 -1
- package/dist/components/themedLayoutV2/sider/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/form/useModalForm/useModalForm.d.ts.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 +4 -4
- package/src/components/breadcrumb/index.tsx +9 -2
- package/src/components/buttons/list/index.tsx +3 -2
- package/src/components/crud/create/index.tsx +3 -2
- package/src/components/crud/edit/index.tsx +3 -2
- package/src/components/crud/list/index.tsx +3 -2
- package/src/components/crud/show/index.tsx +3 -2
- package/src/components/themedLayoutV2/sider/index.tsx +11 -2
- package/src/hooks/form/useModalForm/useModalForm.ts +3 -2
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@refinedev/antd",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.27.0",
|
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
|
"main": "dist/index.js",
|
@@ -24,8 +24,8 @@
|
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
26
|
"@refinedev/cli": "^2.7.0",
|
27
|
-
"@refinedev/ui-tests": "^1.
|
28
|
-
"@refinedev/core": "^4.
|
27
|
+
"@refinedev/ui-tests": "^1.8.0",
|
28
|
+
"@refinedev/core": "^4.25.1",
|
29
29
|
"@esbuild-plugins/node-resolve": "^0.1.4",
|
30
30
|
"@testing-library/jest-dom": "^5.16.4",
|
31
31
|
"@testing-library/react": "^13.1.1",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"dependencies": {
|
50
50
|
"@ant-design/icons": "5.0.1",
|
51
51
|
"@ant-design/pro-layout": "7.8.3",
|
52
|
-
"@refinedev/ui-types": "^1.
|
52
|
+
"@refinedev/ui-types": "^1.17.0",
|
53
53
|
"@tanstack/react-query": "^4.10.1",
|
54
54
|
"antd": "^5.0.5",
|
55
55
|
"dayjs": "^1.10.7",
|
@@ -45,14 +45,21 @@ export const Breadcrumb: React.FC<BreadcrumbProps> = ({
|
|
45
45
|
const breadCrumbItems = breadcrumbs.map(({ label, icon, href }) => ({
|
46
46
|
key: `breadcrumb-item-${label}`,
|
47
47
|
title: (
|
48
|
-
|
48
|
+
<div
|
49
|
+
style={{
|
50
|
+
display: "flex",
|
51
|
+
alignItems: "center",
|
52
|
+
justifyContent: "center",
|
53
|
+
gap: 4,
|
54
|
+
}}
|
55
|
+
>
|
49
56
|
{!hideIcons && icon}
|
50
57
|
{href ? (
|
51
58
|
<ActiveLink to={href}>{label}</ActiveLink>
|
52
59
|
) : (
|
53
60
|
<span>{label}</span>
|
54
61
|
)}
|
55
|
-
|
62
|
+
</div>
|
56
63
|
),
|
57
64
|
}));
|
58
65
|
|
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
useCan,
|
6
6
|
useNavigation,
|
7
7
|
useTranslate,
|
8
|
-
|
8
|
+
useUserFriendlyName,
|
9
9
|
useResource,
|
10
10
|
useRouterContext,
|
11
11
|
useRouterType,
|
@@ -51,6 +51,7 @@ export const ListButton: React.FC<ListButtonProps> = ({
|
|
51
51
|
const routerType = useRouterType();
|
52
52
|
const Link = useLink();
|
53
53
|
const { Link: LegacyLink } = useRouterContext();
|
54
|
+
const getUserFriendlyName = useUserFriendlyName();
|
54
55
|
|
55
56
|
const ActiveLink = routerType === "legacy" ? LegacyLink : Link;
|
56
57
|
|
@@ -118,7 +119,7 @@ export const ListButton: React.FC<ListButtonProps> = ({
|
|
118
119
|
resourceNameFromProps ??
|
119
120
|
propResourceNameOrRouteName
|
120
121
|
}.titles.list`,
|
121
|
-
|
122
|
+
getUserFriendlyName(
|
122
123
|
resource?.meta?.label ??
|
123
124
|
resource?.label ??
|
124
125
|
identifier ??
|
@@ -3,7 +3,7 @@ import { Card, Space, Spin } from "antd";
|
|
3
3
|
import {
|
4
4
|
useNavigation,
|
5
5
|
useTranslate,
|
6
|
-
|
6
|
+
useUserFriendlyName,
|
7
7
|
useRefineContext,
|
8
8
|
useRouterType,
|
9
9
|
useResource,
|
@@ -47,6 +47,7 @@ export const Create: React.FC<CreateProps> = ({
|
|
47
47
|
const routerType = useRouterType();
|
48
48
|
const back = useBack();
|
49
49
|
const { goBack } = useNavigation();
|
50
|
+
const getUserFriendlyName = useUserFriendlyName();
|
50
51
|
|
51
52
|
const { resource, action, identifier } = useResource(resourceFromProps);
|
52
53
|
|
@@ -83,7 +84,7 @@ export const Create: React.FC<CreateProps> = ({
|
|
83
84
|
title ??
|
84
85
|
translate(
|
85
86
|
`${identifier}.titles.create`,
|
86
|
-
`Create ${
|
87
|
+
`Create ${getUserFriendlyName(
|
87
88
|
resource?.meta?.label ??
|
88
89
|
resource?.options?.label ??
|
89
90
|
resource?.label ??
|
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
useMutationMode,
|
6
6
|
useNavigation,
|
7
7
|
useTranslate,
|
8
|
-
|
8
|
+
useUserFriendlyName,
|
9
9
|
useRefineContext,
|
10
10
|
useRouterType,
|
11
11
|
useBack,
|
@@ -65,6 +65,7 @@ export const Edit: React.FC<EditProps> = ({
|
|
65
65
|
const back = useBack();
|
66
66
|
const go = useGo();
|
67
67
|
const { goBack, list: legacyGoList } = useNavigation();
|
68
|
+
const getUserFriendlyName = useUserFriendlyName();
|
68
69
|
|
69
70
|
const {
|
70
71
|
resource,
|
@@ -160,7 +161,7 @@ export const Edit: React.FC<EditProps> = ({
|
|
160
161
|
title ??
|
161
162
|
translate(
|
162
163
|
`${identifier}.titles.edit`,
|
163
|
-
`Edit ${
|
164
|
+
`Edit ${getUserFriendlyName(
|
164
165
|
resource?.meta?.label ??
|
165
166
|
resource?.options?.label ??
|
166
167
|
resource?.label ??
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
2
2
|
import { Space } from "antd";
|
3
3
|
import {
|
4
4
|
useTranslate,
|
5
|
-
|
5
|
+
useUserFriendlyName,
|
6
6
|
useRefineContext,
|
7
7
|
useRouterType,
|
8
8
|
useResource,
|
@@ -40,6 +40,7 @@ export const List: React.FC<ListProps> = ({
|
|
40
40
|
useRefineContext();
|
41
41
|
|
42
42
|
const routerType = useRouterType();
|
43
|
+
const getUserFriendlyName = useUserFriendlyName();
|
43
44
|
|
44
45
|
const { resource, identifier } = useResource(resourceFromProps);
|
45
46
|
|
@@ -75,7 +76,7 @@ export const List: React.FC<ListProps> = ({
|
|
75
76
|
title ??
|
76
77
|
translate(
|
77
78
|
`${identifier}.titles.list`,
|
78
|
-
|
79
|
+
getUserFriendlyName(
|
79
80
|
resource?.meta?.label ??
|
80
81
|
resource?.options?.label ??
|
81
82
|
resource?.label ??
|
@@ -3,7 +3,7 @@ import { Card, Space, Spin } from "antd";
|
|
3
3
|
import {
|
4
4
|
useNavigation,
|
5
5
|
useTranslate,
|
6
|
-
|
6
|
+
useUserFriendlyName,
|
7
7
|
useRefineContext,
|
8
8
|
useResource,
|
9
9
|
useToPath,
|
@@ -59,6 +59,7 @@ export const Show: React.FC<ShowProps> = ({
|
|
59
59
|
const back = useBack();
|
60
60
|
const go = useGo();
|
61
61
|
const { goBack, list: legacyGoList } = useNavigation();
|
62
|
+
const getUserFriendlyName = useUserFriendlyName();
|
62
63
|
|
63
64
|
const {
|
64
65
|
resource,
|
@@ -147,7 +148,7 @@ export const Show: React.FC<ShowProps> = ({
|
|
147
148
|
title ??
|
148
149
|
translate(
|
149
150
|
`${identifier}.titles.show`,
|
150
|
-
`Show ${
|
151
|
+
`Show ${getUserFriendlyName(
|
151
152
|
resource?.meta?.label ??
|
152
153
|
resource?.options?.label ??
|
153
154
|
resource?.label ??
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { CSSProperties } from "react";
|
2
2
|
import { Layout, Menu, Grid, Drawer, Button, theme } from "antd";
|
3
3
|
import {
|
4
4
|
DashboardOutlined,
|
@@ -38,6 +38,7 @@ export const ThemedSiderV2: React.FC<RefineThemedLayoutV2SiderProps> = ({
|
|
38
38
|
render,
|
39
39
|
meta,
|
40
40
|
fixed,
|
41
|
+
activeItemDisabled = false,
|
41
42
|
}) => {
|
42
43
|
const { token } = useToken();
|
43
44
|
const {
|
@@ -108,6 +109,11 @@ export const ThemedSiderV2: React.FC<RefineThemedLayoutV2SiderProps> = ({
|
|
108
109
|
undefined && children.length === 0
|
109
110
|
);
|
110
111
|
|
112
|
+
const linkStyle: CSSProperties =
|
113
|
+
activeItemDisabled && isSelected
|
114
|
+
? { pointerEvents: "none" }
|
115
|
+
: {};
|
116
|
+
|
111
117
|
return (
|
112
118
|
<CanAccess
|
113
119
|
key={item.key}
|
@@ -120,8 +126,11 @@ export const ThemedSiderV2: React.FC<RefineThemedLayoutV2SiderProps> = ({
|
|
120
126
|
<Menu.Item
|
121
127
|
key={item.key}
|
122
128
|
icon={icon ?? (isRoute && <UnorderedListOutlined />)}
|
129
|
+
style={linkStyle}
|
123
130
|
>
|
124
|
-
<Link to={route ?? ""}
|
131
|
+
<Link to={route ?? ""} style={linkStyle}>
|
132
|
+
{label}
|
133
|
+
</Link>
|
125
134
|
{!siderCollapsed && isSelected && (
|
126
135
|
<div className="ant-menu-tree-arrow" />
|
127
136
|
)}
|
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
BaseRecord,
|
10
10
|
LiveModeProps,
|
11
11
|
BaseKey,
|
12
|
-
|
12
|
+
useUserFriendlyName,
|
13
13
|
useResource,
|
14
14
|
FormWithSyncWithLocationParams,
|
15
15
|
useParsed,
|
@@ -151,6 +151,7 @@ export const useModalForm = <
|
|
151
151
|
|
152
152
|
const parsed = useParsed();
|
153
153
|
const go = useGo();
|
154
|
+
const getUserFriendlyName = useUserFriendlyName();
|
154
155
|
|
155
156
|
const action = rest.action ?? actionFromParams ?? "";
|
156
157
|
|
@@ -321,7 +322,7 @@ export const useModalForm = <
|
|
321
322
|
okButtonProps: saveButtonPropsSF,
|
322
323
|
title: translate(
|
323
324
|
`${identifier}.titles.${rest.action}`,
|
324
|
-
`${
|
325
|
+
`${getUserFriendlyName(
|
325
326
|
`${rest.action} ${
|
326
327
|
resource?.meta?.label ??
|
327
328
|
resource?.options?.label ??
|