@applica-software-guru/react-admin 1.5.237 → 1.5.238
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 +52 -52
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +7110 -7270
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +51 -51
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ra-buttons/CreateInDialogButton.tsx +18 -5
- package/src/components/ra-buttons/EditInDialogButton.tsx +12 -4
- package/src/playground/components/ra-lists/CategoryList.jsx +1 -1
- package/src/playground/components/ra-lists/UserList.jsx +3 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Toolbar } from '@/components/ra-forms';
|
|
2
|
-
import { Breakpoint, Dialog } from '@mui/material';
|
|
3
|
-
import { CreateBase, UseCreateMutateParams, useResourceContext } from 'ra-core';
|
|
4
|
-
import {
|
|
2
|
+
import { Breakpoint, Button, Dialog } from '@mui/material';
|
|
3
|
+
import { CreateBase, UseCreateMutateParams, useResourceContext, useTranslate } from 'ra-core';
|
|
4
|
+
import { CreateButton, CreateButtonProps, CreateProps, SaveButton } from 'ra-ui-materialui';
|
|
5
5
|
import React, { Children, PropsWithChildren, useCallback, useState } from 'react';
|
|
6
6
|
import { FieldValues, useFormContext } from 'react-hook-form';
|
|
7
7
|
import { useQueryClient } from 'react-query';
|
|
@@ -51,6 +51,7 @@ type SubmitButtonProps = {
|
|
|
51
51
|
function SubmitButton(props: SubmitButtonProps) {
|
|
52
52
|
const { onSubmit, closeDialog } = props;
|
|
53
53
|
const { handleSubmit } = useFormContext();
|
|
54
|
+
const translate = useTranslate();
|
|
54
55
|
const handleClick = useCallback(
|
|
55
56
|
(event: any) => {
|
|
56
57
|
(event as Event).preventDefault();
|
|
@@ -59,7 +60,11 @@ function SubmitButton(props: SubmitButtonProps) {
|
|
|
59
60
|
},
|
|
60
61
|
[handleSubmit, onSubmit, closeDialog]
|
|
61
62
|
);
|
|
62
|
-
return
|
|
63
|
+
return (
|
|
64
|
+
<Button onClick={handleClick} color="primary" variant="contained" size="medium">
|
|
65
|
+
{translate('ra.action.save')}
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
63
68
|
}
|
|
64
69
|
type CreateInDialogButtonProps = PropsWithChildren &
|
|
65
70
|
CreateProps &
|
|
@@ -89,6 +94,7 @@ function CreateInDialogButton(props: CreateInDialogButtonProps) {
|
|
|
89
94
|
const { children, maxWidth = 'md', fullWidth = true, fullScreen, onSubmit, mutationOptions, scroll, ...rest } = props;
|
|
90
95
|
const queryClient = useQueryClient();
|
|
91
96
|
const resource = useResourceContext();
|
|
97
|
+
const translate = useTranslate();
|
|
92
98
|
const Child = Children.only(children);
|
|
93
99
|
const [open, setOpen] = useState(false);
|
|
94
100
|
const handleOpen = useCallback(() => setOpen(true), []);
|
|
@@ -131,6 +137,11 @@ function CreateInDialogButton(props: CreateInDialogButtonProps) {
|
|
|
131
137
|
maxWidth={maxWidth}
|
|
132
138
|
fullWidth={fullWidth}
|
|
133
139
|
fullScreen={fullScreen}
|
|
140
|
+
sx={{
|
|
141
|
+
'& .MuiToolbar-root': {
|
|
142
|
+
position: 'relative !important'
|
|
143
|
+
}
|
|
144
|
+
}}
|
|
134
145
|
>
|
|
135
146
|
{React.isValidElement(Child)
|
|
136
147
|
? React.cloneElement(Child, {
|
|
@@ -138,7 +149,9 @@ function CreateInDialogButton(props: CreateInDialogButtonProps) {
|
|
|
138
149
|
modal: true,
|
|
139
150
|
toolbar: (
|
|
140
151
|
<Toolbar>
|
|
141
|
-
<Button variant="text" size="medium"
|
|
152
|
+
<Button variant="text" size="medium" onClick={handleClose}>
|
|
153
|
+
{translate('ra.action.cancel')}
|
|
154
|
+
</Button>
|
|
142
155
|
{onSubmit ? (
|
|
143
156
|
<SubmitButton onSubmit={onSubmit!} closeDialog={handleClose} />
|
|
144
157
|
) : (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Toolbar } from '@/components/ra-forms';
|
|
2
|
-
import { Breakpoint, Dialog } from '@mui/material';
|
|
3
|
-
import { EditBase, UseUpdateMutateParams, useRecordContext } from 'ra-core';
|
|
4
|
-
import {
|
|
2
|
+
import { Breakpoint, Button, Dialog } from '@mui/material';
|
|
3
|
+
import { EditBase, UseUpdateMutateParams, useRecordContext, useTranslate } from 'ra-core';
|
|
4
|
+
import { EditButton, EditProps, SaveButton } from 'ra-ui-materialui';
|
|
5
5
|
import React, { Children, PropsWithChildren, useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
type ResponsiveButtonProps = {
|
|
@@ -43,6 +43,7 @@ function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
|
|
|
43
43
|
[handleClose, props.mutationOptions]
|
|
44
44
|
);
|
|
45
45
|
const record = useRecordContext();
|
|
46
|
+
const translate = useTranslate();
|
|
46
47
|
return (
|
|
47
48
|
<>
|
|
48
49
|
<ResponsiveButton {...rest} onClick={handleOpen} />
|
|
@@ -63,6 +64,11 @@ function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
|
|
|
63
64
|
maxWidth={maxWidth}
|
|
64
65
|
fullScreen={fullScreen}
|
|
65
66
|
keepMounted={false}
|
|
67
|
+
sx={{
|
|
68
|
+
'& .MuiToolbar-root': {
|
|
69
|
+
position: 'relative !important'
|
|
70
|
+
}
|
|
71
|
+
}}
|
|
66
72
|
>
|
|
67
73
|
{React.isValidElement(Child)
|
|
68
74
|
? React.cloneElement(Child, {
|
|
@@ -70,7 +76,9 @@ function EditInDialogButton(props: EditInDialogButtonProps): JSX.Element {
|
|
|
70
76
|
modal: true,
|
|
71
77
|
toolbar: (
|
|
72
78
|
<Toolbar>
|
|
73
|
-
<Button variant="text" size="medium"
|
|
79
|
+
<Button variant="text" size="medium" onClick={handleClose}>
|
|
80
|
+
{translate('ra.action.cancel')}
|
|
81
|
+
</Button>
|
|
74
82
|
<SaveButton type="button" />
|
|
75
83
|
</Toolbar>
|
|
76
84
|
)
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
|
|
17
17
|
function CategoryAddButton() {
|
|
18
18
|
return (
|
|
19
|
-
<CreateInDialogButton maxWidth="sm" redirect="list" size="
|
|
19
|
+
<CreateInDialogButton maxWidth="sm" redirect="list" size="medium" variant="text">
|
|
20
20
|
<CategoryForm />
|
|
21
21
|
</CreateInDialogButton>
|
|
22
22
|
);
|
|
@@ -41,15 +41,15 @@ function RolesInput({ record, source, roles, ...props }) {
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function ImageField(
|
|
44
|
+
function ImageField(record) {
|
|
45
45
|
return <CoverField source="image" record={record} width={50} height={50} circle />;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
function NameField(
|
|
48
|
+
function NameField(record) {
|
|
49
49
|
return record.name;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
function SecondaryField(
|
|
52
|
+
function SecondaryField(record) {
|
|
53
53
|
return record.email;
|
|
54
54
|
}
|
|
55
55
|
|