Skip to content

Commit e38e3d5

Browse files
authored
Merge branch 'next' into disable-radiobuttongroupitem
2 parents eb8a543 + b66f0ac commit e38e3d5

File tree

652 files changed

+21285
-8594
lines changed

Some content is hidden

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

652 files changed

+21285
-8594
lines changed

.eslintignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -166,43 +166,6 @@ jobs:
166166
- name: Build crm
167167
run: make build-crm
168168

169-
greenframe:
170-
runs-on: ubuntu-latest
171-
name: GreenFrame
172-
needs: [e-commerce]
173-
if: github.event_name == 'push' && github.ref_type == 'tag' && contains(github.ref, 'refs/tags/v') && !contains('beta', github.ref) && !contains('alpha', github.ref)
174-
steps:
175-
# To use this repository's private action,
176-
# you must check out the repository
177-
- name: Checkout
178-
uses: actions/checkout@v4
179-
with:
180-
fetch-depth: 2 # Fetch HEAD^ to enable git comparison
181-
- name: Use Node.js LTS
182-
uses: actions/setup-node@v4
183-
with:
184-
node-version: '22.x'
185-
cache: 'yarn'
186-
- name: Install dependencies
187-
run: yarn
188-
- name: Download demo build
189-
uses: actions/download-artifact@v4
190-
with:
191-
name: demo-build
192-
- name: Unzip demo build
193-
run: unzip -o -u demo-build.zip
194-
- name: Run e-commerce
195-
# Run the demo in production mode
196-
run: cd ./examples/demo/dist && python3 -m http.server 4173 &
197-
- name: Install GreenFrame CLI
198-
run: curl https://assets.greenframe.io/install.sh | bash
199-
shell: bash
200-
- name: Run GreenFrame Analysis
201-
env:
202-
GREENFRAME_SECRET_TOKEN: ${{secrets.GREENFRAME_SECRET_TOKEN}}
203-
run: greenframe analyze -C .greenframe.yml --branchName master
204-
shell: bash
205-
206169
create-react-admin:
207170
runs-on: ubuntu-latest
208171
name: create-react-admin

.yarn/patches/@storybook-source-loader-npm-8.4.4-55dafc88e2.patch

Lines changed: 0 additions & 28 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 132 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,22 @@ The `<Resource>` component defines CRUD pages (`list`, `edit`, and `create`) for
6565
```jsx
6666
// in posts.js
6767
import * as React from "react";
68-
import { List, Datagrid, Edit, Create, SimpleForm, DateField, TextField, EditButton, TextInput, DateInput, useRecordContext } from 'react-admin';
68+
import { List, DataTable, Edit, Create, SimpleForm, DateField, EditButton, TextInput, DateInput, useRecordContext } from 'react-admin';
6969
import BookIcon from '@mui/icons-material/Book';
7070
export const PostIcon = BookIcon;
7171

7272
export const PostList = () => (
7373
<List>
74-
<Datagrid>
75-
<TextField source="id" />
76-
<TextField source="title" />
77-
<DateField source="published_at" />
78-
<TextField source="average_note" />
79-
<TextField source="views" />
80-
<EditButton />
81-
</Datagrid>
74+
<DataTable>
75+
<DataTable.Col source="id" />
76+
<DataTable.Col source="title" />
77+
<DataTable.Col source="published_at" field={DateField} />
78+
<DataTable.Col source="average_note" />
79+
<DataTable.Col source="views" />
80+
<DataTable.Col>
81+
<EditButton />
82+
</DataTable.Col>
83+
</DataTable>
8284
</List>
8385
);
8486

cypress/.eslintrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/AccordionForm.md

Lines changed: 46 additions & 18 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" />
@@ -504,19 +504,19 @@ This component renders a [Material UI `<Accordion>` component](https://mui.com/c
504504

505505
Here are all the props you can set on the `<AccordionForm.Panel>` component:
506506

507-
| Prop | Required | Type | Default | Description |
508-
| ----------------- | -------- | ----------------------- | ------- | ------------------------------------------------------------------------------------------------ |
509-
| `authorizationError` | Optional | `ReactNode` | `null` | The content to display when authorization checks fail |
510-
| `children` | Required | `ReactNode` | - | A list of `<Input>` elements |
511-
| `defaultExpanded` | Optional | `boolean` | `false` | Set to true to have the accordion expanded by default (except if autoClose = true on the parent) |
512-
| `disabled` | Optional | `boolean` | `false` | If true, the accordion will be displayed in a disabled state. |
513-
| `enableAccessControl` | Optional | `boolean` | `false` | Enable checking authorization rights for this panel's inputs |
514-
| `id` | Optional | `string` | - | An id for this Accordion to be used in the [`useFormGroup`](./Upgrade.md#useformgroup-hook-returned-state-has-changed) hook and for CSS classes. |
515-
| `label` | Required | `string` or `ReactNode` | - | The main label used as the accordion summary. Appears in red when the accordion has errors |
516-
| `loading` | Optional | `ReactNode` | | The content to display when checking authorizations |
517-
| `secondary` | Optional | `string` or `ReactNode` | - | The secondary label used as the accordion summary |
518-
| `square` | Optional | `boolean` | `false` | If true, rounded corners are disabled. |
519-
| `sx` | Optional | `Object` | - | An object containing the MUI style overrides to apply to the root component. |
507+
| Prop | Required | Type | Default | Description |
508+
| ----------------- | -------- | ----------------------- | ------- |-------------------------------------------------------------------------------------------------------------------|
509+
| `authorizationError` | Optional | `ReactNode` | `null` | The content to display when authorization checks fail |
510+
| `children` | Required | `ReactNode` | - | A list of `<Input>` elements |
511+
| `defaultExpanded` | Optional | `boolean` | `false` | Set to true to have the accordion expanded by default (except if autoClose = true on the parent) |
512+
| `disabled` | Optional | `boolean` | `false` | If true, the accordion will be displayed in a disabled state. |
513+
| `enableAccessControl` | Optional | `boolean` | `false` | Enable checking authorization rights for this panel's inputs |
514+
| `id` | Optional | `string` | - | An id for this Accordion to be used in the [`useFormGroup`](./Forms.md#grouping-inputs) hook and for CSS classes. |
515+
| `label` | Required | `string` or `ReactNode` | - | The main label used as the accordion summary. Appears in red when the accordion has errors |
516+
| `loading` | Optional | `ReactNode` | | The content to display when checking authorizations |
517+
| `secondary` | Optional | `string` or `ReactNode` | - | The secondary label used as the accordion summary |
518+
| `square` | Optional | `boolean` | `false` | If true, rounded corners are disabled. |
519+
| `sx` | Optional | `Object` | - | An object containing the MUI style overrides to apply to the root component. |
520520

521521
```tsx
522522
import {
@@ -830,15 +830,43 @@ 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

841-
`<AccordionForm>` can use [Access Control](./AccessControl.md) to check permissions for each section and input. To enable this feature, set the `enableAccessControl` prop to `true`.
869+
`<AccordionForm>` can use [Access Control](./Permissions.md#access-control) to check permissions for each section and input. To enable this feature, set the `enableAccessControl` prop to `true`.
842870

843871
Check the [`enableAccessControl` prop](#enableaccesscontrol) section for more details.
844872

docs/Actions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,17 @@ See the [Success and Error Side Effects](#success-and-error-side-effects) below
156156

157157
{% raw %}
158158
```jsx
159-
import { List, Datagrid, TextField } from 'react-admin';
159+
import { List, DataTable } from 'react-admin';
160160

161161
const PostList = () => (
162162
<List
163163
queryOptions={{ onSettled: (data, error) => console.log(data, error) }}
164164
>
165-
<Datagrid>
166-
<TextField source="id" />
167-
<TextField source="title" />
168-
<TextField source="body" />
169-
</Datagrid>
165+
<DataTable>
166+
<DataTable.Col source="id" />
167+
<DataTable.Col source="title" />
168+
<DataTable.Col source="body" />
169+
</DataTable>
170170
</List>
171171
);
172172
```
@@ -319,8 +319,8 @@ To execute some logic after a query or a mutation is complete, use the `onSucces
319319
- [`useNotify`](./useNotify.md): Return a function to display a notification.
320320
- [`useRedirect`](./useRedirect.md): Return a function to redirect the user to another page.
321321
- [`useRefresh`](./useRefresh.md): Return a function to force a rerender of the current view (equivalent to pressing the Refresh button).
322-
- [`useUnselect`](./useUnselect.md): Return a function to unselect lines in the current `Datagrid` based on the ids passed to it.
323-
- [`useUnselectAll`](./useUnselectAll.md): Return a function to unselect all lines in the current `Datagrid`.
322+
- [`useUnselect`](./useUnselect.md): Return a function to unselect lines in the current `<DataTable>` based on the ids passed to it.
323+
- [`useUnselectAll`](./useUnselectAll.md): Return a function to unselect all lines in the current `<DataTable>`.
324324

325325
### `onSuccess`
326326

docs/Admin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ You might want to dynamically define the resources when the app starts. To do so
12661266
12671267
### Using a Function As `<Admin>` Child
12681268
1269-
The `<Admin>` component accepts a function as one of its children and this function can return a Promise. If you also defined an `authProvider`, the child function will receive the result of a call to `authProvider.getPermissions()` (you can read more about this in the [Auth Provider](./Authentication.md#enabling-auth-features) chapter).
1269+
The `<Admin>` component accepts a function as one of its children and this function can return a Promise. If you also defined an `authProvider`, the child function will receive the result of a call to `authProvider.getPermissions()` (you can read more about this in the [Auth Provider](./Permissions.md#authprovidergetpermissions) chapter).
12701270
12711271
For instance, getting the resource from an API might look like:
12721272

0 commit comments

Comments
 (0)