You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/AccordionForm.md
+46-18Lines changed: 46 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ title: "AccordionForm"
5
5
6
6
# `<AccordionForm>`
7
7
8
-
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<imgclass="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)<imgclass="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.
|`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. |
|`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. |
520
520
521
521
```tsx
522
522
import {
@@ -830,15 +830,43 @@ const PersonEdit = () => (
830
830
```
831
831
{% endraw %}
832
832
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.
834
834
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.
836
836
837
-
Check [the `<AutoSave>` component](./AutoSave.md) documentation for more details.
837
+
To enable this behavior, add the `<AutoPersistInStore>` component inside the form component:
Check [the `<AutoPersistInStore>` component](./AutoPersistInStore.md) documentation for more details.
838
866
839
867
## Access Control
840
868
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`.
842
870
843
871
Check the [`enableAccessControl` prop](#enableaccesscontrol) section for more details.
Copy file name to clipboardExpand all lines: docs/Admin.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1266,7 +1266,7 @@ You might want to dynamically define the resources when the app starts. To do so
1266
1266
1267
1267
### Using a Function As `<Admin>` Child
1268
1268
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).
1270
1270
1271
1271
For instance, getting the resource from an API might look like:
0 commit comments