Skip to content

Commit d83ce97

Browse files
Merge branch 'main' into fix/chakra-ui/meta-in-show-button
2 parents 57cf972 + cb85e0b commit d83ce97

311 files changed

Lines changed: 6943 additions & 2921 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursorignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ documentation/.docusaurus/
77
documentation/build/
88
documentation/node_modules/
99
documentation/plugins/
10-
documentation/src/
1110
documentation/static/
1211
documentation/test/
1312
documentation/versioned_docs/

.github/workflows/build-examples.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "packages/**"
77
- "examples/**"
88
- "cypress/e2e/**"
9+
- ".github/workflows/scripts/**"
910
types:
1011
- labeled
1112
- synchronize

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
steps:
3838
- uses: actions/checkout@v4
3939
with:
40-
fetch-depth: 0
40+
fetch-depth: ${{ github.ref == 'refs/heads/main' && 500 || 1 }}
4141
- uses: pnpm/action-setup@v3
4242
with:
4343
version: 9

.github/workflows/refine-registry-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ on:
1414
branches:
1515
- next
1616

17+
concurrency:
18+
group: next-refine-registry-release
19+
cancel-in-progress: false
20+
1721
jobs:
1822
publish:
1923
runs-on: ubuntu-latest
2024

21-
2225
strategy:
2326
matrix:
2427
node-version: [18.x]

.github/workflows/scripts/e2e-examples.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ const getProjectInfo = (path) => {
4949

5050
const command = `pnpm start --scope ${projectName}`;
5151

52-
let port;
53-
54-
if (allDependencies.includes("vite")) {
55-
port = 4173;
56-
}
52+
let port = 4173;
5753

5854
if (
5955
allDependencies.includes("next") ||
@@ -101,18 +97,18 @@ const waitOnFor = async (resource) => {
10197

10298
return resource;
10399
} catch (error) {
104-
if (error) console.log(error);
100+
if (error) console.log(JSON.stringify(error, null, 2));
105101

106102
return false;
107103
}
108104
};
109105

110106
const waitForServer = async (port) => {
111107
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: We have a valid use-case here.
112-
return new Promise(async (resolve) => {
108+
return new Promise(async (resolve, reject) => {
113109
setTimeout(() => {
114110
resolve(false);
115-
}, 120000);
111+
}, 720_000);
116112

117113
try {
118114
const resolvedResource = await Promise.any([
@@ -123,19 +119,19 @@ const waitForServer = async (port) => {
123119

124120
resolve(resolvedResource);
125121
} catch (error) {
126-
if (error) console.log(error);
122+
if (error) console.log(JSON.stringify(error, null, 2));
127123

128-
resolve(false);
124+
reject(error);
129125
}
130126
});
131127
};
132128

133129
const waitForClose = (resource) => {
134130
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: We have a valid use-case here.
135-
return new Promise(async (resolve) => {
131+
return new Promise(async (resolve, reject) => {
136132
setTimeout(() => {
137133
resolve(false);
138-
}, 120000);
134+
}, 720_000);
139135

140136
try {
141137
await waitOn({
@@ -146,9 +142,9 @@ const waitForClose = (resource) => {
146142

147143
resolve(resource);
148144
} catch (error) {
149-
if (error) console.log(error);
145+
if (error) console.log(JSON.stringify(error, null, 2));
150146

151-
resolve(false);
147+
reject(error);
152148
}
153149
});
154150
};
@@ -207,7 +203,7 @@ const runTests = async () => {
207203
}
208204
} catch (error) {
209205
prettyLog("red", "Error occured on waiting for the server to start");
210-
if (error) console.log(error);
206+
if (error) console.log(JSON.stringify(error, null, 2));
211207

212208
failed = true;
213209
}
@@ -232,7 +228,7 @@ const runTests = async () => {
232228
}
233229
} catch (error) {
234230
prettyLog("red", `Error occured on tests for ${path}`);
235-
if (error) console.log(error);
231+
if (error) console.log(JSON.stringify(error, null, 2));
236232

237233
failed = true;
238234
} finally {
@@ -256,7 +252,7 @@ const runTests = async () => {
256252
}
257253
} catch (error) {
258254
prettyLog("red", "Error occured on killing the dev server");
259-
if (error) console.log(error);
255+
if (error) console.log(JSON.stringify(error, null, 2));
260256
failed = true;
261257
}
262258
}
@@ -286,7 +282,7 @@ runTests()
286282
process.exit(0);
287283
} else {
288284
prettyLog("red", "Tests Failed or an Error Occured");
289-
if (error) console.log(error);
285+
if (error) console.log(JSON.stringify(error, null, 2));
290286

291287
if (failedExamples)
292288
prettyLog(
@@ -302,7 +298,7 @@ runTests()
302298
})
303299
.catch((error) => {
304300
prettyLog("red", "Tests Failed or an Error Occured");
305-
if (error) console.log(error);
301+
if (error) console.log(JSON.stringify(error, null, 2));
306302
process.exitCode = 1;
307303
process.exit(1);
308304
});

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Features
99
- #### Added swizzle support for `@pankod/refine-core` package
1010

1111
- The swizzle is a command in refine-cli that allows you to customize the Refine's supported components and data providers. It allows you to eject selected files from the Refine packages and modify depending on your needs.
12-
- [Refer to Swizzle Docs for more information](https://refine.dev/docs/packages/documentation/cli/#swizzle)
12+
- [Refer to Swizzle Docs for more information](https://refine.dev/docs/packages/cli/#swizzle)
1313

1414
Swizzleable components:
1515

documentation/docs/ui-integrations/ant-design/components/basic-views/show/index.md

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,121 @@ render(
359359

360360
[Refer to the `usePermissions` documentation for detailed usage. &#8594](/docs/api-reference/core/hooks/authentication/usePermissions/)
361361

362+
### deleteButtonProps
363+
364+
If the resource has the `canDelete` property and you want to customize this button, you can use the `deleteButtonProps` property like the code below.
365+
366+
```tsx live disableScroll previewHeight=280px url=http://localhost:3000/posts/show/123
367+
setInitialRoutes(["/posts/show/123"]);
368+
const { ShowButton, Edit } = RefineAntd;
369+
370+
const { default: simpleRest } = RefineSimpleRest;
371+
372+
const dataProvider = simpleRest("https://api.fake-rest.refine.dev");
373+
374+
const customDataProvider = {
375+
...dataProvider,
376+
deleteOne: async ({ resource, id, variables }) => {
377+
return {
378+
data: {},
379+
};
380+
},
381+
};
382+
383+
const authProvider = {
384+
login: async () => {
385+
return {
386+
success: true,
387+
redirectTo: "/",
388+
};
389+
},
390+
register: async () => {
391+
return {
392+
success: true,
393+
};
394+
},
395+
forgotPassword: async () => {
396+
return {
397+
success: true,
398+
};
399+
},
400+
updatePassword: async () => {
401+
return {
402+
success: true,
403+
};
404+
},
405+
logout: async () => {
406+
return {
407+
success: true,
408+
redirectTo: "/",
409+
};
410+
},
411+
check: () => ({
412+
authenticated: true,
413+
}),
414+
onError: async (error) => {
415+
console.error(error);
416+
return { error };
417+
},
418+
getPermissions: async () => ["admin"],
419+
getIdentity: async () => null,
420+
};
421+
422+
// visible-block-start
423+
import { Show } from "@refinedev/antd";
424+
import { usePermissions } from "@refinedev/core";
425+
426+
const PostShow: React.FC = () => {
427+
const { data: permissionsData } = usePermissions();
428+
return (
429+
<Show
430+
/* highlight-start */
431+
canDelete={permissionsData?.includes("admin")}
432+
deleteButtonProps={{ size: "small" }}
433+
canEdit={permissionsData?.includes("admin")}
434+
/* highlight-end */
435+
>
436+
<p>Rest of your page here</p>
437+
</Show>
438+
);
439+
};
440+
// visible-block-end
441+
442+
render(
443+
<ReactRouter.BrowserRouter>
444+
<RefineAntdDemo
445+
authProvider={authProvider}
446+
dataProvider={customDataProvider}
447+
resources={[
448+
{
449+
name: "posts",
450+
list: "/posts",
451+
show: "/posts/show/:id",
452+
edit: "/posts/edit/:id",
453+
},
454+
]}
455+
>
456+
<ReactRouter.Routes>
457+
<ReactRouter.Route
458+
path="/posts"
459+
element={
460+
<div>
461+
<p>This page is empty.</p>
462+
<ShowButton recordItemId="123">Show Item 123</ShowButton>
463+
</div>
464+
}
465+
/>
466+
<ReactRouter.Route path="/posts/show/:id" element={<PostShow />} />
467+
<ReactRouter.Route
468+
path="/posts/edit/:id"
469+
element={<Edit>Edit Page</Edit>}
470+
/>
471+
</ReactRouter.Routes>
472+
</RefineAntdDemo>
473+
</ReactRouter.BrowserRouter>,
474+
);
475+
```
476+
362477
### recordItemId
363478

364479
The `<Show>` component reads the `id` information from the route by default. `recordItemId` is used when it cannot read from the URL (when used on a custom page, modal or drawer).
@@ -897,7 +1012,6 @@ If [`canEdit`](#candelete-and-canedit) is `false`, [`<EditButton>`][edit-button]
8971012

8981013
```tsx live disableScroll previewHeight=280px url=http://localhost:3000/posts/show/123
8991014
setInitialRoutes(["/posts/show/123"]);
900-
9011015
// visible-block-start
9021016
import { Show } from "@refinedev/antd";
9031017
import { Button } from "antd";

0 commit comments

Comments
 (0)