@refinedev/antd 5.24.0 → 5.26.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinedev/antd",
3
- "version": "5.24.0",
3
+ "version": "5.26.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.7.0",
28
- "@refinedev/core": "^4.22.0",
27
+ "@refinedev/ui-tests": "^1.7.2",
28
+ "@refinedev/core": "^4.24.0",
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",
@@ -41,7 +41,7 @@
41
41
  "jest": "^29.3.1",
42
42
  "jest-environment-jsdom": "^29.3.1",
43
43
  "postcss": "^8.1.4",
44
- "react-router-dom": "6.11.2",
44
+ "react-router-dom": "^6.8.1",
45
45
  "ts-jest": "^29.0.3",
46
46
  "tsup": "^6.7.0",
47
47
  "typescript": "^4.7.4"
@@ -56,7 +56,7 @@ export const DeleteButton: React.FC<DeleteButtonProps> = ({
56
56
 
57
57
  const translate = useTranslate();
58
58
 
59
- const { id, resource } = useResource(
59
+ const { id, resource, identifier } = useResource(
60
60
  resourceNameFromProps ?? propResourceNameOrRouteName,
61
61
  );
62
62
 
@@ -104,12 +104,12 @@ export const DeleteButton: React.FC<DeleteButtonProps> = ({
104
104
  }
105
105
  okButtonProps={{ disabled: isLoading }}
106
106
  onConfirm={(): void => {
107
- if ((recordItemId ?? id) && resource?.name) {
107
+ if ((recordItemId ?? id) && identifier) {
108
108
  setWarnWhen(false);
109
109
  mutate(
110
110
  {
111
111
  id: recordItemId ?? id ?? "",
112
- resource: resource?.name,
112
+ resource: identifier,
113
113
  mutationMode,
114
114
  successNotification,
115
115
  errorNotification,
@@ -56,7 +56,7 @@ export const ListButton: React.FC<ListButtonProps> = ({
56
56
 
57
57
  const translate = useTranslate();
58
58
 
59
- const { resource } = useResource(
59
+ const { resource, identifier } = useResource(
60
60
  resourceNameFromProps ?? propResourceNameOrRouteName,
61
61
  );
62
62
 
@@ -114,14 +114,14 @@ export const ListButton: React.FC<ListButtonProps> = ({
114
114
  (children ??
115
115
  translate(
116
116
  `${
117
- resource?.name ??
117
+ identifier ??
118
118
  resourceNameFromProps ??
119
119
  propResourceNameOrRouteName
120
120
  }.titles.list`,
121
121
  userFriendlyResourceName(
122
122
  resource?.meta?.label ??
123
123
  resource?.label ??
124
- resource?.name ??
124
+ identifier ??
125
125
  pickNotDeprecated(
126
126
  resourceNameFromProps,
127
127
  propResourceNameOrRouteName,
@@ -34,12 +34,12 @@ export const RefreshButton: React.FC<RefreshButtonProps> = ({
34
34
  }) => {
35
35
  const translate = useTranslate();
36
36
 
37
- const { resource, id } = useResource(
37
+ const { identifier, id } = useResource(
38
38
  resourceNameFromProps ?? propResourceNameOrRouteName,
39
39
  );
40
40
 
41
41
  const { refetch, isFetching } = useOne({
42
- resource: resource?.name,
42
+ resource: identifier,
43
43
  id: recordItemId ?? id,
44
44
  queryOptions: {
45
45
  enabled: false,
@@ -48,7 +48,7 @@ export const Create: React.FC<CreateProps> = ({
48
48
  const back = useBack();
49
49
  const { goBack } = useNavigation();
50
50
 
51
- const { resource, action } = useResource(resourceFromProps);
51
+ const { resource, action, identifier } = useResource(resourceFromProps);
52
52
 
53
53
  const breadcrumb =
54
54
  typeof breadcrumbFromProps === "undefined"
@@ -82,12 +82,12 @@ export const Create: React.FC<CreateProps> = ({
82
82
  title={
83
83
  title ??
84
84
  translate(
85
- `${resource?.name}.titles.create`,
85
+ `${identifier}.titles.create`,
86
86
  `Create ${userFriendlyResourceName(
87
87
  resource?.meta?.label ??
88
88
  resource?.options?.label ??
89
89
  resource?.label ??
90
- resource?.name,
90
+ identifier,
91
91
  "singular",
92
92
  )}`,
93
93
  )
@@ -70,6 +70,7 @@ export const Edit: React.FC<EditProps> = ({
70
70
  resource,
71
71
  action,
72
72
  id: idFromParams,
73
+ identifier,
73
74
  } = useResource(resourceFromProps);
74
75
 
75
76
  const goListPath = useToPath({
@@ -93,19 +94,13 @@ export const Edit: React.FC<EditProps> = ({
93
94
  const listButtonProps: ListButtonProps | undefined = hasList
94
95
  ? {
95
96
  ...(isLoading ? { disabled: true } : {}),
96
- resource:
97
- routerType === "legacy"
98
- ? resource?.route
99
- : resource?.identifier ?? resource?.name,
97
+ resource: routerType === "legacy" ? resource?.route : identifier,
100
98
  }
101
99
  : undefined;
102
100
 
103
101
  const refreshButtonProps: RefreshButtonProps = {
104
102
  ...(isLoading ? { disabled: true } : {}),
105
- resource:
106
- routerType === "legacy"
107
- ? resource?.route
108
- : resource?.identifier ?? resource?.name,
103
+ resource: routerType === "legacy" ? resource?.route : identifier,
109
104
  recordItemId: id,
110
105
  dataProviderName,
111
106
  };
@@ -115,9 +110,7 @@ export const Edit: React.FC<EditProps> = ({
115
110
  ? {
116
111
  ...(isLoading ? { disabled: true } : {}),
117
112
  resource:
118
- routerType === "legacy"
119
- ? resource?.route
120
- : resource?.identifier ?? resource?.name,
113
+ routerType === "legacy" ? resource?.route : identifier,
121
114
  mutationMode,
122
115
  onSuccess: () => {
123
116
  if (routerType === "legacy") {
@@ -166,12 +159,12 @@ export const Edit: React.FC<EditProps> = ({
166
159
  title={
167
160
  title ??
168
161
  translate(
169
- `${resource?.name}.titles.edit`,
162
+ `${identifier}.titles.edit`,
170
163
  `Edit ${userFriendlyResourceName(
171
164
  resource?.meta?.label ??
172
165
  resource?.options?.label ??
173
166
  resource?.label ??
174
- resource?.name,
167
+ identifier,
175
168
  "singular",
176
169
  )}`,
177
170
  )
@@ -41,7 +41,7 @@ export const List: React.FC<ListProps> = ({
41
41
 
42
42
  const routerType = useRouterType();
43
43
 
44
- const { resource } = useResource(resourceFromProps);
44
+ const { resource, identifier } = useResource(resourceFromProps);
45
45
 
46
46
  const isCreateButtonVisible =
47
47
  canCreate ??
@@ -58,9 +58,7 @@ export const List: React.FC<ListProps> = ({
58
58
  ? {
59
59
  size: "middle",
60
60
  resource:
61
- routerType === "legacy"
62
- ? resource?.route
63
- : resource?.identifier ?? resource?.name,
61
+ routerType === "legacy" ? resource?.route : identifier,
64
62
  ...createButtonPropsFromProps,
65
63
  }
66
64
  : undefined;
@@ -76,12 +74,12 @@ export const List: React.FC<ListProps> = ({
76
74
  title={
77
75
  title ??
78
76
  translate(
79
- `${resource?.name}.titles.list`,
77
+ `${identifier}.titles.list`,
80
78
  userFriendlyResourceName(
81
79
  resource?.meta?.label ??
82
80
  resource?.options?.label ??
83
81
  resource?.label ??
84
- resource?.name,
82
+ identifier,
85
83
  "plural",
86
84
  ),
87
85
  )
@@ -64,6 +64,7 @@ export const Show: React.FC<ShowProps> = ({
64
64
  resource,
65
65
  action,
66
66
  id: idFromParams,
67
+ identifier,
67
68
  } = useResource(resourceFromProps);
68
69
 
69
70
  const goListPath = useToPath({
@@ -86,20 +87,14 @@ export const Show: React.FC<ShowProps> = ({
86
87
 
87
88
  const listButtonProps: ListButtonProps | undefined = hasList
88
89
  ? {
89
- resource:
90
- routerType === "legacy"
91
- ? resource?.route
92
- : resource?.identifier ?? resource?.name,
90
+ resource: routerType === "legacy" ? resource?.route : identifier,
93
91
  }
94
92
  : undefined;
95
93
  const editButtonProps: EditButtonProps | undefined = isEditButtonVisible
96
94
  ? {
97
95
  ...(isLoading ? { disabled: true } : {}),
98
96
  type: "primary",
99
- resource:
100
- routerType === "legacy"
101
- ? resource?.route
102
- : resource?.identifier ?? resource?.name,
97
+ resource: routerType === "legacy" ? resource?.route : identifier,
103
98
  recordItemId: id,
104
99
  }
105
100
  : undefined;
@@ -108,9 +103,7 @@ export const Show: React.FC<ShowProps> = ({
108
103
  ? {
109
104
  ...(isLoading ? { disabled: true } : {}),
110
105
  resource:
111
- routerType === "legacy"
112
- ? resource?.route
113
- : resource?.identifier ?? resource?.name,
106
+ routerType === "legacy" ? resource?.route : identifier,
114
107
  recordItemId: id,
115
108
  onSuccess: () => {
116
109
  if (routerType === "legacy") {
@@ -124,10 +117,7 @@ export const Show: React.FC<ShowProps> = ({
124
117
  : undefined;
125
118
  const refreshButtonProps: RefreshButtonProps = {
126
119
  ...(isLoading ? { disabled: true } : {}),
127
- resource:
128
- routerType === "legacy"
129
- ? resource?.route
130
- : resource?.identifier ?? resource?.name,
120
+ resource: routerType === "legacy" ? resource?.route : identifier,
131
121
  recordItemId: id,
132
122
  dataProviderName,
133
123
  };
@@ -156,12 +146,12 @@ export const Show: React.FC<ShowProps> = ({
156
146
  title={
157
147
  title ??
158
148
  translate(
159
- `${resource?.name}.titles.show`,
149
+ `${identifier}.titles.show`,
160
150
  `Show ${userFriendlyResourceName(
161
151
  resource?.meta?.label ??
162
152
  resource?.options?.label ??
163
153
  resource?.label ??
164
- resource?.name,
154
+ identifier,
165
155
  "singular",
166
156
  )}`,
167
157
  )
@@ -108,6 +108,7 @@ export const useForm = <
108
108
  createMutationOptions,
109
109
  updateMutationOptions,
110
110
  id: idFromProps,
111
+ overtimeOptions,
111
112
  }: UseFormProps<
112
113
  TQueryFnData,
113
114
  TError,
@@ -161,6 +162,7 @@ export const useForm = <
161
162
  createMutationOptions,
162
163
  updateMutationOptions,
163
164
  id: idFromProps,
165
+ overtimeOptions,
164
166
  });
165
167
 
166
168
  const { formLoading, onFinish, queryResult, id } = useFormCoreResult;
@@ -143,7 +143,11 @@ export const useModalForm = <
143
143
 
144
144
  const { form, formProps, id, setId, formLoading, onFinish } = useFormProps;
145
145
 
146
- const { resource, action: actionFromParams } = useResource(rest.resource);
146
+ const {
147
+ resource,
148
+ action: actionFromParams,
149
+ identifier,
150
+ } = useResource(rest.resource);
147
151
 
148
152
  const parsed = useParsed();
149
153
  const go = useGo();
@@ -159,7 +163,7 @@ export const useModalForm = <
159
163
  typeof syncWithLocation === "object" && "key" in syncWithLocation
160
164
  ? syncWithLocation.key
161
165
  : resource && action && syncWithLocation
162
- ? `modal-${resource?.identifier ?? resource?.name}-${action}`
166
+ ? `modal-${identifier}-${action}`
163
167
  : undefined;
164
168
 
165
169
  const translate = useTranslate();
@@ -316,13 +320,13 @@ export const useModalForm = <
316
320
  width: "1000px",
317
321
  okButtonProps: saveButtonPropsSF,
318
322
  title: translate(
319
- `${resource?.name}.titles.${rest.action}`,
323
+ `${identifier}.titles.${rest.action}`,
320
324
  `${userFriendlyResourceName(
321
325
  `${rest.action} ${
322
326
  resource?.meta?.label ??
323
327
  resource?.options?.label ??
324
328
  resource?.label ??
325
- resource?.name
329
+ identifier
326
330
  }`,
327
331
  "singular",
328
332
  )}`,
@@ -93,6 +93,7 @@ export const useSimpleList = <
93
93
  setSorters,
94
94
  createLinkForSyncWithLocation,
95
95
  tableQueryResult: queryResult,
96
+ overtime,
96
97
  } = useTableCore({
97
98
  resource,
98
99
  initialSorter,
@@ -226,5 +227,6 @@ export const useSimpleList = <
226
227
  setPageSize,
227
228
  pageCount,
228
229
  createLinkForSyncWithLocation,
230
+ overtime,
229
231
  };
230
232
  };
@@ -100,6 +100,7 @@ export const useTable = <
100
100
  setSorter,
101
101
  createLinkForSyncWithLocation,
102
102
  pageCount,
103
+ overtime,
103
104
  } = useTableCore<TQueryFnData, TError, TData>({
104
105
  permanentSorter,
105
106
  permanentFilter,
@@ -264,5 +265,6 @@ export const useTable = <
264
265
  setPageSize,
265
266
  pageCount,
266
267
  createLinkForSyncWithLocation,
268
+ overtime,
267
269
  };
268
270
  };