Skip to content

Commit 8a728d4

Browse files
committed
Merge branch 'master' into update-vite
2 parents 117c1a8 + 9a46596 commit 8a728d4

File tree

160 files changed

+1862
-763
lines changed

Some content is hidden

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

160 files changed

+1862
-763
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## 5.7.3
4+
5+
* Fix `<ShowGuesser>` print incorrect code for reference arrays ([#10682](https://github.com/marmelab/react-admin/pull/10682)) ([djhi](https://github.com/djhi))
6+
* Fix `<RichTextField>` should render `emptyText` when value is an empty string ([#10670](https://github.com/marmelab/react-admin/pull/10670)) ([slax57](https://github.com/slax57))
7+
* Fix TS error when using `EditGuesser` in module's default export ([#10669](https://github.com/marmelab/react-admin/pull/10669)) ([slax57](https://github.com/slax57))
8+
* Fix `useInput` default value overrides `null` ([#10665](https://github.com/marmelab/react-admin/pull/10665)) ([djhi](https://github.com/djhi))
9+
* [Doc] Fix `useNotify` custom notification with close example ([#10683](https://github.com/marmelab/react-admin/pull/10683)) ([djhi](https://github.com/djhi))
10+
* [doc] Add `AutoPersistInStore` doc page ([#10681](https://github.com/marmelab/react-admin/pull/10681)) ([erwanMarmelab](https://github.com/erwanMarmelab))
11+
* [Doc] Fix docs anchors ([#10675](https://github.com/marmelab/react-admin/pull/10675)) ([WiXSL](https://github.com/WiXSL))
12+
* [Doc] Fix Dialog Forms examples regarding `hasCreate` ([#10671](https://github.com/marmelab/react-admin/pull/10671)) ([slax57](https://github.com/slax57))
13+
* [Doc] Explain how React admin handles empty values ([#10666](https://github.com/marmelab/react-admin/pull/10666)) ([djhi](https://github.com/djhi))
14+
* [Doc] Update NextJS integration ([#10664](https://github.com/marmelab/react-admin/pull/10664)) ([djhi](https://github.com/djhi))
15+
* [Doc] Document how to setup Remix for production debugging ([#10663](https://github.com/marmelab/react-admin/pull/10663)) ([djhi](https://github.com/djhi))
16+
* [Demo] Use Echarts instead of rechart ([#10677](https://github.com/marmelab/react-admin/pull/10677)) ([fzaninotto](https://github.com/fzaninotto))
17+
* [Demo] Fix order chart currency ([#10668](https://github.com/marmelab/react-admin/pull/10668)) ([fzaninotto](https://github.com/fzaninotto))
18+
* Bump vite from 5.4.16 to 5.4.17 ([#10659](https://github.com/marmelab/react-admin/pull/10659)) ([dependabot[bot]](https://github.com/apps/dependabot))
19+
320
## 5.7.2
421

522
* Fix `<FilterLiveForm>` compatibility with react-hook-form 7.55.0 ([#10657](https://github.com/marmelab/react-admin/pull/10657)) ([slax57](https://github.com/slax57))

docs/AccordionForm.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: "AccordionForm"
55

66
# `<AccordionForm>`
77

8-
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" /> component offers an alternative layout for Edit and Create forms, where Inputs are grouped into expandable panels.
8+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component offers an alternative layout for Edit and Create forms, where Inputs are grouped into expandable panels.
99

1010
<video controls autoplay playsinline muted loop>
1111
<source src="https://react-admin-ee.marmelab.com/assets/ra-accordion-form-overview.mp4" type="video/mp4" />
@@ -830,11 +830,39 @@ const PersonEdit = () => (
830830
```
831831
{% endraw %}
832832

833-
Note that you **must** set the `<AccordionForm resetOptions>` prop to `{ keepDirtyValues: true }`. If you forget that prop, any change entered by the end user after the autosave but before its acknowledgement by the server will be lost.
833+
Check [the `<AutoSave>` component](./AutoSave.md) documentation for more details.
834834

835-
If you're using it in an `<Edit>` page, you must also use a `pessimistic` or `optimistic` [`mutationMode`](./Edit.md#mutationmode) - `<AutoSave>` doesn't work with the default `mutationMode="undoable"`.
835+
An alternative to the `<AutoSave>` component is to use [the `<AutoPersistInStore>` component](./AutoPersistInStore.md). This component saves the form values in the local storage of the browser. This way, if the user navigates away without saving, the form values are reapplied when the user comes back to the page. This is useful for long forms where users may spend a lot of time.
836836

837-
Check [the `<AutoSave>` component](./AutoSave.md) documentation for more details.
837+
To enable this behavior, add the `<AutoPersistInStore>` component inside the form component:
838+
839+
```tsx
840+
import { AccordionForm, AutoPersistInStore } from '@react-admin/ra-form-layout';
841+
import { Create, TextInput, DateInput, SelectInput } from 'react-admin';
842+
843+
const CustomerCreate = () => (
844+
<Create>
845+
<AccordionForm>
846+
<AccordionForm.Panel label="Identity">
847+
<TextInput source="first_name" />
848+
<TextInput source="last_name" />
849+
<DateInput source="born" />
850+
<SelectInput source="sex" choices={[
851+
{ id: 'male', name: 'Male' },
852+
{ id: 'female', name: 'Female' },
853+
{ id: 'other', name: 'Other' },
854+
]} />
855+
</AccordionForm.Panel>
856+
<AccordionForm.Panel label="Work">
857+
{/* ... */}
858+
</AccordionForm.Panel>
859+
<AutoPersistInStore />
860+
</AccordionForm>
861+
</Create>
862+
);
863+
```
864+
865+
Check [the `<AutoPersistInStore>` component](./AutoPersistInStore.md) documentation for more details.
838866

839867
## Access Control
840868

docs/AppTheme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const App = () => (
108108

109109
React-admin comes with 5 built-in themes, each one having a light and a dark variant. You can use them as a starting point for your custom theme, or use them as-is.
110110

111-
| &nbsp;&nbsp; [Default](#default) [![Default light theme](./img/defaultLightTheme1.jpg)]((#default)) | &nbsp;&nbsp; [B&W](#bw) [![B&W light theme](./img/bwLightTheme1.jpg)](#bw) |
111+
| &nbsp;&nbsp; [Default](#default) [![Default light theme](./img/defaultLightTheme1.jpg)](#default) | &nbsp;&nbsp; [B&W](#bw) [![B&W light theme](./img/bwLightTheme1.jpg)](#bw) |
112112
| &nbsp;&nbsp; [Nano](#nano) [![Nano light theme](./img/nanoLightTheme1.jpg)](#nano) | &nbsp;&nbsp; [Radiant](#radiant) [![Radiant light theme](./img/radiantLightTheme1.jpg)](#radiant) |
113113
| &nbsp;&nbsp; [House](#house) [![House light theme](./img/houseLightTheme1.jpg)](#house) |
114114

docs/AuthRBAC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Building up on react-admin's [Access Control features](./Permissions.md#access-c
1111
<source src="./img/ra-rbac.mp4" type="video/mp4" />
1212
</video>
1313

14-
The RBAC features are part of [ra-rbac](https://react-admin-ee.marmelab.com/documentation/ra-rbac), an [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" /> package. Test them live in the [Enterprise Edition Storybook](https://react-admin.github.io/ra-enterprise/?path=/story/ra-rbac-full-app--full-app).
14+
The RBAC features are part of [ra-rbac](https://react-admin-ee.marmelab.com/documentation/ra-rbac), an [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> package. Test them live in the [Enterprise Edition Storybook](https://react-admin.github.io/ra-enterprise/?path=/story/ra-rbac-full-app--full-app).
1515

1616
## At a Glance
1717

docs/AutoPersistInStore.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
layout: default
3+
title: "The AutoPersistInStore Component"
4+
---
5+
6+
# `<AutoPersistInStore>`
7+
8+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component prevents data loss in forms by automatically saving the form data in the store when users navigate away from the page. When users return to the page, it reapplies the saved data to the form.
9+
10+
<video controls autoplay playsinline muted loop>
11+
<source src="./img/AutoPersistInStore.mp4" type="video/mp4"/>
12+
Your browser does not support the video tag.
13+
</video>
14+
15+
The temporary form data is only saved when the user navigates away from the page, and it is removed when the user submits the form or closes the tab. Users can opt out of the prefilling by clicking the "Cancel" button in the notification.
16+
17+
Saved data is not sent to the server. It is only persisted using the [store](./Store.md) and is removed when the user logs out.
18+
19+
## Usage
20+
21+
Add `<AutoPersistInStore>` inside a react-admin form (`<SimpleForm>`, `<TabbedForm>`, `<LongForm>`, etc.):
22+
23+
```tsx
24+
import { AutoPersistInStore } from '@react-admin/ra-form-layout';
25+
import { Edit, SimpleForm, TextInput } from 'react-admin';
26+
27+
const PostEdit = () => (
28+
<Edit>
29+
<SimpleForm>
30+
<TextInput source="title" />
31+
<TextInput source="teaser" />
32+
<AutoPersistInStore />
33+
</SimpleForm>
34+
</Edit>
35+
);
36+
```
37+
38+
The component will automatically save the form data in the store on unmount and reapply it when the form is mounted again.
39+
40+
It works both on create and edit forms.
41+
42+
## Props
43+
44+
| Prop | Required | Type | Default | Description |
45+
| --------------------- | -------- | ---------- | -------------------------------------------------------- | ------------------------------------------------------------- |
46+
| `getStoreKey` | - | `function` | - | Function to use your own store key. |
47+
| `notificationMessage` | - | `string` | "Applied previous unsaved changes" | Notification message to inform users that their previously saved changes have been applied. |
48+
49+
## `getStoreKey`
50+
51+
To save the current form data in the [store](./useStoreContext.md), `<AutoPersistInStore>` uses the following store key:
52+
53+
`ra-persist-[RESOURCE_NAME]-[RECORD_ID]`
54+
55+
For example, if you are editing a `posts` resource with the ID `123`, the store key will be: `ra-persist-posts-123`. In case of a create form, the record ID is replaced by `"create"`
56+
57+
You can override this key by passing a custom function as the `getStoreKey` prop. It expects two parameters:
58+
59+
- `resource`: The current resource.
60+
- `record`: The current record if you are in an [edit context](./useEditContext.md).
61+
62+
```tsx
63+
<AutoPersistInStore
64+
getStoreKey={
65+
(resource: ResourceContextValue, record: RaRecord<Identifier> | undefined) =>
66+
`my-custom-persist-key-${resource}-${record && record.hasOwnProperty('id') ? record.id : 'create'}`
67+
}
68+
/>
69+
```
70+
71+
72+
## `notificationMessage`
73+
74+
When `<AutoPersistInStore>` component applies the changes from the store to a form, react-admin informs users with a notification.
75+
76+
The default notification message is `ra-form-layout.auto_persist_in_store.applied_changes`, which is translated using the i18n provider (the default English translation is `Applied previous unsaved changes`).
77+
78+
You can customize it with the `notificationMessage` prop:
79+
80+
```tsx
81+
<AutoPersistInStore notificationMessage="Modifications applied" />
82+
```
83+
84+
**Tip:** You can pass a translation key as well:
85+
86+
```tsx
87+
<AutoPersistInStore notificationMessage="myroot.message.auto_persist_applied" />
88+
```

docs/AutoSave.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: "The AutoSave Component"
55

66
# `<AutoSave>`
77

8-
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" /> component enables autosaving of the form. Alternative to [`<SaveButton>`](./SaveButton.md), it's ideal for long data entry tasks, and reduces the risk of data loss.
8+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component enables autosaving of the form. Alternative to [`<SaveButton>`](./SaveButton.md), it's ideal for long data entry tasks, and reduces the risk of data loss.
99

1010
<video controls autoplay playsinline muted loop>
1111
<source src="./img/AutoSave.webm" type="video/webm"/>

docs/Breadcrumb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: "The Breadcrumb Component"
55

66
# `<Breadcrumb>`
77

8-
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" /> component renders a breadcrumb path that automatically adapts to the page location. It helps users navigate large web applications.
8+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component renders a breadcrumb path that automatically adapts to the page location. It helps users navigate large web applications.
99

1010
<video controls autoplay playsinline muted loop width="100%">
1111
<source src="https://react-admin-ee.marmelab.com/assets/ra-navigation/latest/breadcumb-nested-resource.mp4" type="video/mp4" />

docs/Buttons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Alternately, pass a `successMessage` prop:
234234

235235
## `<BulkUpdateFormButton>`
236236

237-
This component, part of the [enterprise edition](https://react-admin-ee.marmelab.com/documentation/ra-form-layout)<img class="icon" src="./img/premium.svg" />, lets users edit multiple records at once. To be used inside [the `<Datagrid bulkActionButtons>` prop](./Datagrid.md#bulkactionbuttons).
237+
This component, part of the [enterprise edition](https://react-admin-ee.marmelab.com/documentation/ra-form-layout)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" />, lets users edit multiple records at once. To be used inside [the `<Datagrid bulkActionButtons>` prop](./Datagrid.md#bulkactionbuttons).
238238

239239
<video controls autoplay playsinline muted loop>
240240
<source src="./img/BulkUpdateButton-SimpleForm.webm" type="video/webm"/>

docs/Calendar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: "The Calendar Component"
55

66
# `<Calendar>`
77

8-
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" /> component, part of [the `ra-calendar` module](https://react-admin-ee.marmelab.com/documentation/ra-calendar), renders a list of events as a calendar.
8+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component, part of [the `ra-calendar` module](https://react-admin-ee.marmelab.com/documentation/ra-calendar), renders a list of events as a calendar.
99

1010
<video controls autoplay playsinline muted loop>
1111
<source src="https://react-admin-ee.marmelab.com/assets/ra-calendar.mp4" type="video/mp4" />

docs/ContainerLayout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: "ContainerLayout"
55

66
# `<ContainerLayout>`
77

8-
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" /> component offers an alternative to react-admin's `<Layout>` for applications with a limited number of resources. It displays the content in a centered container, has no sidebar, and uses the top bar for navigation.
8+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component offers an alternative to react-admin's `<Layout>` for applications with a limited number of resources. It displays the content in a centered container, has no sidebar, and uses the top bar for navigation.
99

1010
![Container layout](https://react-admin-ee.marmelab.com/assets/ra-navigation/latest/container-layout.png)
1111

0 commit comments

Comments
 (0)