From a86c39eddb39644dfeae62d59bd3d70b7fe9efbe Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 7 Nov 2023 10:50:56 +0100 Subject: [PATCH 1/2] [Doc] Document `` deletion side effect --- docs/EditInDialogButton.md | 329 ++++++++++++++++++++++++++++++++++--- 1 file changed, 306 insertions(+), 23 deletions(-) diff --git a/docs/EditInDialogButton.md b/docs/EditInDialogButton.md index c8696585cd1..76002d4f424 100644 --- a/docs/EditInDialogButton.md +++ b/docs/EditInDialogButton.md @@ -5,9 +5,7 @@ title: "EditInDialogButton" # `` -This [Enterprise Edition](https://marmelab.com/ra-enterprise) component offers a way to open an `` view inside a dialog, hence allowing to edit a record without leaving the current view. - -It can be useful in case you want the ability to edit a record linked by a reference to the currently edited record, or if you have a nested `` inside a `` or an `` view. +This [Enterprise Edition](https://marmelab.com/ra-enterprise) component renders a button opening an `` view inside a dialog, hence allowing to edit a record without leaving the current view. +It can be useful in case you want the ability to edit a record linked by a reference to the currently edited record, or if you have a nested `` inside a `` or an `` view. + Note that this component doesn't use routing, so it doesn't change the URL. It's therefore not possible to bookmark the edit dialog, or to link to it from another page. If you need that functionality, use [``](./EditDialog.md) instead. ## Usage -Put `` wherever you would put an ``, and use the same children as you would for an [``](./Edit.md) component (e.g. a ``): +First, install the `@react-admin/ra-form-layout` package: + +```sh +npm install --save @react-admin/ra-form-layout +# or +yarn add @react-admin/ra-form-layout +``` + +**Tip**: [`ra-form-layout`](https://marmelab.com/ra-enterprise/modules/ra-form-layout#createindialogbutton-editindialogbutton-and-EditInDialogButton) is hosted in a private npm registry. You need to subscribe to one of the [Enterprise Edition](https://marmelab.com/ra-enterprise/) plans to access this package. + +Then, put `` wherever you would put an ``, and use the same children as you would for an [``](./Edit.md) component (e.g. a ``): ```jsx import { @@ -27,7 +37,7 @@ import { ReferenceManyField, Show, SimpleForm, - SimpleShowLayout, + SimpleForm, TextField, TextInput, } from "react-admin"; @@ -35,7 +45,7 @@ import { EditInDialogButton } from "@react-admin/ra-form-layout"; const CompanyShow = () => ( - + @@ -51,24 +61,297 @@ const CompanyShow = () => ( - + ); ``` -It accepts the following props: +## Props + +`` accepts the following props: + +| Prop | Required | Type | Default | Description | +| -------------- | -------- | ----------------- | ------- | ----------- | +| `children` | Required | `ReactNode` | | The content of the dialog. | +| `ButtonProps` | Optional | `object` | | Object containing props to pass to Material UI's `