@applica-software-guru/react-admin 1.5.255 → 1.5.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-buttons/EditInDialogButton.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +53 -55
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +5212 -5262
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +52 -54
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ra-buttons/CreateInDialogButton.tsx +21 -19
- package/src/components/ra-buttons/EditInDialogButton.tsx +35 -24
- package/src/playground/components/ra-forms/CategoryForm.jsx +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button as RaButton } from './Button';
|
|
2
2
|
import { Toolbar } from '@/components/ra-forms';
|
|
3
3
|
import { PlusCircleOutlined } from '@ant-design/icons';
|
|
4
|
-
import { Breakpoint, Button, Dialog } from '@mui/material';
|
|
4
|
+
import { Breakpoint, Button, Dialog, DialogContent } from '@mui/material';
|
|
5
5
|
import { CreateBase, UseCreateMutateParams, useResourceContext, useTranslate } from 'ra-core';
|
|
6
6
|
import { ButtonProps, CreateButton, CreateButtonProps, CreateProps, SaveButton } from 'ra-ui-materialui';
|
|
7
7
|
import React, { Children, PropsWithChildren, useCallback, useState } from 'react';
|
|
@@ -158,24 +158,26 @@ function CreateInDialogButton(props: CreateInDialogButtonProps) {
|
|
|
158
158
|
fullWidth={fullWidth}
|
|
159
159
|
fullScreen={fullScreen}
|
|
160
160
|
>
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
<
|
|
168
|
-
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
161
|
+
<DialogContent sx={{ m: 0, p: 0 }}>
|
|
162
|
+
{React.isValidElement(Child)
|
|
163
|
+
? React.cloneElement(Child, {
|
|
164
|
+
...Child.props,
|
|
165
|
+
modal: true,
|
|
166
|
+
toolbar: (
|
|
167
|
+
<Toolbar>
|
|
168
|
+
<Button variant="text" size="medium" onClick={handleClose}>
|
|
169
|
+
{translate('ra.action.cancel')}
|
|
170
|
+
</Button>
|
|
171
|
+
{onSubmit ? (
|
|
172
|
+
<SubmitButton onSubmit={onSubmit!} closeDialog={handleClose} />
|
|
173
|
+
) : (
|
|
174
|
+
<SaveButton type="button" />
|
|
175
|
+
)}
|
|
176
|
+
</Toolbar>
|
|
177
|
+
)
|
|
178
|
+
})
|
|
179
|
+
: null}
|
|
180
|
+
</DialogContent>
|
|
179
181
|
</Dialog>
|
|
180
182
|
</CreateBase>
|
|
181
183
|
</>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button } from './Button';
|
|
2
2
|
import { Toolbar } from '@/components/ra-forms';
|
|
3
|
-
import { Breakpoint, Dialog } from '@mui/material';
|
|
3
|
+
import { Breakpoint, Dialog, DialogContent } from '@mui/material';
|
|
4
4
|
import { EditBase, UseUpdateMutateParams, useRecordContext } from 'ra-core';
|
|
5
5
|
import { EditButton, EditProps, SaveButton } from 'ra-ui-materialui';
|
|
6
6
|
import React, { Children, PropsWithChildren, useCallback, useState } from 'react';
|
|
@@ -76,7 +76,16 @@ type EditInDialogButtonProps = PropsWithChildren &
|
|
|
76
76
|
onSubmit?: SubmitFunction;
|
|
77
77
|
};
|
|
78
78
|
function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
|
|
79
|
-
const {
|
|
79
|
+
const {
|
|
80
|
+
children,
|
|
81
|
+
maxWidth = 'md',
|
|
82
|
+
fullWidth = true,
|
|
83
|
+
fullScreen,
|
|
84
|
+
mutationOptions,
|
|
85
|
+
onSubmit,
|
|
86
|
+
scroll = 'paper',
|
|
87
|
+
...rest
|
|
88
|
+
} = props;
|
|
80
89
|
const [open, setOpen] = useState(false);
|
|
81
90
|
const Child = Children.only(children);
|
|
82
91
|
const handleOpen = useCallback(() => setOpen(true), []);
|
|
@@ -110,28 +119,30 @@ function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
|
|
|
110
119
|
fullScreen={fullScreen}
|
|
111
120
|
keepMounted={false}
|
|
112
121
|
>
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
<DialogContent sx={{ m: 0, p: 0 }}>
|
|
123
|
+
{React.isValidElement(Child)
|
|
124
|
+
? React.cloneElement(Child, {
|
|
125
|
+
...Child.props,
|
|
126
|
+
modal: true,
|
|
127
|
+
toolbar: (
|
|
128
|
+
<Toolbar>
|
|
129
|
+
<Button
|
|
130
|
+
disableIconOnly
|
|
131
|
+
variant="text"
|
|
132
|
+
size="medium"
|
|
133
|
+
onClick={handleClose}
|
|
134
|
+
label="ra.action.cancel"
|
|
135
|
+
/>
|
|
136
|
+
{onSubmit ? (
|
|
137
|
+
<SubmitButton onSubmit={onSubmit!} closeDialog={handleClose} />
|
|
138
|
+
) : (
|
|
139
|
+
<SaveButton type="button" />
|
|
140
|
+
)}
|
|
141
|
+
</Toolbar>
|
|
142
|
+
)
|
|
143
|
+
})
|
|
144
|
+
: null}
|
|
145
|
+
</DialogContent>
|
|
135
146
|
</Dialog>
|
|
136
147
|
</EditBase>
|
|
137
148
|
</>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BooleanInput, LocalizedTextInput, SimpleForm, required } from '@/';
|
|
2
|
+
import { ArrayInput, SimpleFormIterator } from 'ra-ui-materialui';
|
|
2
3
|
|
|
3
4
|
function requiredAtLeastOneTranslation(message = 'ra.validation.at_least_one_translation') {
|
|
4
5
|
return (value, values) => {
|