@applica-software-guru/react-admin 1.4.191 → 1.4.196
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 +2 -1
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-buttons/EditInDialogButton.d.ts +2 -1
- package/dist/components/ra-buttons/EditInDialogButton.d.ts.map +1 -1
- package/dist/components/ra-forms/CardForm.d.ts.map +1 -1
- package/dist/components/ra-forms/Create.d.ts.map +1 -1
- package/dist/components/ra-forms/Edit.d.ts.map +1 -1
- package/dist/components/ra-forms/LongForm/BaseForm.d.ts.map +1 -1
- package/dist/components/ra-forms/TabbedForm.d.ts.map +1 -1
- package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +2 -2
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +460 -422
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +34 -34
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ra-buttons/CreateInDialogButton.tsx +12 -3
- package/src/components/ra-buttons/EditInDialogButton.tsx +8 -3
- package/src/components/ra-forms/CardForm.tsx +9 -2
- package/src/components/ra-forms/Create.tsx +6 -0
- package/src/components/ra-forms/Edit.tsx +4 -1
- package/src/components/ra-forms/LongForm/BaseForm.tsx +9 -2
- package/src/components/ra-forms/SimpleForm.tsx +3 -3
- package/src/components/ra-forms/TabbedForm.tsx +4 -1
- package/src/components/ra-forms/TableForm/TableFormIterator.tsx +4 -3
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useResourceContext,
|
|
12
12
|
useTranslate
|
|
13
13
|
} from 'react-admin';
|
|
14
|
-
import { Dialog, Fab, useMediaQuery } from '@mui/material';
|
|
14
|
+
import { Dialog, Fab, useMediaQuery, useTheme } from '@mui/material';
|
|
15
15
|
import React, { useCallback, useState } from 'react';
|
|
16
16
|
import { SxProps, Theme, styled } from '@mui/material/styles';
|
|
17
17
|
import { PlusCircleOutlined } from '@ant-design/icons';
|
|
@@ -153,6 +153,7 @@ export type CreateInDialogButtonProps = {
|
|
|
153
153
|
scrollToTop?: boolean;
|
|
154
154
|
className?: string;
|
|
155
155
|
sx?: SxProps;
|
|
156
|
+
style?: React.CSSProperties;
|
|
156
157
|
children: React.ReactElement;
|
|
157
158
|
/**
|
|
158
159
|
* If set to false, the button will always render as a regular button, regardless of the screen size.
|
|
@@ -175,6 +176,7 @@ export function CreateInDialogButton({
|
|
|
175
176
|
scrollToTop = true,
|
|
176
177
|
className,
|
|
177
178
|
sx,
|
|
179
|
+
style,
|
|
178
180
|
fab = true,
|
|
179
181
|
onSubmit,
|
|
180
182
|
onSuccess,
|
|
@@ -185,6 +187,7 @@ export function CreateInDialogButton({
|
|
|
185
187
|
const translate = useTranslate();
|
|
186
188
|
const resource = useResourceContext();
|
|
187
189
|
const { openDialog, closeDialog } = useAppConfig();
|
|
190
|
+
const theme = useTheme();
|
|
188
191
|
|
|
189
192
|
const handleOpen = useCallback(() => openDialog(resource, () => setOpen(true)), [openDialog, resource]);
|
|
190
193
|
const handleClose = useCallback(() => closeDialog(resource, () => setOpen(false)), [closeDialog, resource]);
|
|
@@ -204,14 +207,20 @@ export function CreateInDialogButton({
|
|
|
204
207
|
<PlusCircleOutlined />
|
|
205
208
|
</StyledFab>
|
|
206
209
|
) : (
|
|
207
|
-
<Button {...props} sx={sx} label={label} onClick={handleOpen}>
|
|
210
|
+
<Button {...props} sx={sx} label={label} onClick={handleOpen} style={style}>
|
|
208
211
|
<PlusCircleOutlined />
|
|
209
212
|
</Button>
|
|
210
213
|
)}
|
|
211
214
|
<Dialog
|
|
212
215
|
open={open}
|
|
213
216
|
scroll="body"
|
|
214
|
-
sx={{
|
|
217
|
+
sx={{
|
|
218
|
+
'& .MuiToolbar-root': {
|
|
219
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
220
|
+
position: 'initial',
|
|
221
|
+
padding: 2.5
|
|
222
|
+
}
|
|
223
|
+
}}
|
|
215
224
|
onClose={handleClose}
|
|
216
225
|
fullWidth={fullWidth}
|
|
217
226
|
maxWidth={maxWidth}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'react-admin';
|
|
12
12
|
import React, { useCallback, useState } from 'react';
|
|
13
13
|
|
|
14
|
-
import { Breakpoint, Dialog } from '@mui/material';
|
|
14
|
+
import { Breakpoint, Dialog, useTheme } from '@mui/material';
|
|
15
15
|
import { Edit } from '@mui/icons-material';
|
|
16
16
|
import { Toolbar } from '../ra-forms';
|
|
17
17
|
import { useAppConfig } from '../../hooks';
|
|
@@ -72,12 +72,14 @@ export type EditInDialogButtonProps = {
|
|
|
72
72
|
maxWidth?: false | Breakpoint | undefined;
|
|
73
73
|
label?: string;
|
|
74
74
|
children: React.ReactElement;
|
|
75
|
+
style?: React.CSSProperties;
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
export function EditInDialogButton({
|
|
78
79
|
fullWidth = true,
|
|
79
80
|
maxWidth = 'md',
|
|
80
81
|
label = 'ra.action.edit',
|
|
82
|
+
style,
|
|
81
83
|
...props
|
|
82
84
|
}: EditInDialogButtonProps): JSX.Element {
|
|
83
85
|
const [open, setOpen] = useState(false);
|
|
@@ -85,10 +87,11 @@ export function EditInDialogButton({
|
|
|
85
87
|
const resource = useResourceContext();
|
|
86
88
|
const handleOpen = useCallback(() => openDialog(resource, () => setOpen(true)), [openDialog, resource]);
|
|
87
89
|
const handleClose = useCallback(() => closeDialog(resource, () => setOpen(false)), [closeDialog, resource]);
|
|
90
|
+
const theme = useTheme();
|
|
88
91
|
|
|
89
92
|
return (
|
|
90
93
|
<>
|
|
91
|
-
<Button label={label} onClick={handleOpen}>
|
|
94
|
+
<Button label={label} onClick={handleOpen} style={style}>
|
|
92
95
|
<Edit />
|
|
93
96
|
</Button>
|
|
94
97
|
<Dialog
|
|
@@ -96,7 +99,9 @@ export function EditInDialogButton({
|
|
|
96
99
|
scroll="body"
|
|
97
100
|
sx={{
|
|
98
101
|
'& .MuiToolbar-root': {
|
|
99
|
-
|
|
102
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
103
|
+
position: 'initial',
|
|
104
|
+
padding: 2.5
|
|
100
105
|
}
|
|
101
106
|
}}
|
|
102
107
|
onClose={handleClose}
|
|
@@ -66,8 +66,15 @@ type StyledFormProps = {
|
|
|
66
66
|
const StyledForm = styled(Form, { slot: 'root' })(({ theme, spacing }: StyledFormProps) => ({
|
|
67
67
|
backgroundColor: 'transparent',
|
|
68
68
|
'& .RaToolbar-desktopToolbar': {
|
|
69
|
-
marginTop: theme.spacing((spacing as number) *
|
|
70
|
-
padding: 0
|
|
69
|
+
marginTop: theme.spacing((spacing as number) * 1.25),
|
|
70
|
+
padding: 0,
|
|
71
|
+
minHeight: 'unset'
|
|
72
|
+
},
|
|
73
|
+
'& .RaToolbar-mobileToolbar': {
|
|
74
|
+
paddingTop: '20px !important',
|
|
75
|
+
paddingRight: '0 !important',
|
|
76
|
+
paddingLeft: '0 !important',
|
|
77
|
+
paddingBottom: 0,
|
|
71
78
|
}
|
|
72
79
|
}));
|
|
73
80
|
|
|
@@ -81,6 +81,12 @@ export const Create = styled(CreateWithDefaults, { slot: 'root' })(({ theme }) =
|
|
|
81
81
|
'& .RaCreate-main>.MuiPaper-root:first-of-type': {
|
|
82
82
|
backgroundColor: theme.palette.background.default
|
|
83
83
|
},
|
|
84
|
+
'& .RaToolbar-mobileToolbar': {
|
|
85
|
+
position: 'initial !important',
|
|
86
|
+
paddingLeft: '20px !important',
|
|
87
|
+
paddingRight: '20px !important',
|
|
88
|
+
paddingTop: '0 !important',
|
|
89
|
+
},
|
|
84
90
|
// Ci ho messo 4 ore per scrivere questa riga di codice e risolvere un problema con react-sticky-box ed i Long Form.
|
|
85
91
|
// L'overflow è di default 'hidden', a noi serve visibile per consentire a react-sticky-box di funzionare e gestire la visiblità con ancore
|
|
86
92
|
// di tutti gli elementi presenti all'interno della pagina.
|
|
@@ -15,7 +15,10 @@ const StyledEdit = styled(RaEdit, { slot: 'root' })(({ theme }) => ({
|
|
|
15
15
|
},
|
|
16
16
|
|
|
17
17
|
'& .RaToolbar-mobileToolbar': {
|
|
18
|
-
|
|
18
|
+
position: 'initial !important',
|
|
19
|
+
paddingLeft: '20px !important',
|
|
20
|
+
paddingRight: '20px !important',
|
|
21
|
+
paddingTop: '0 !important'
|
|
19
22
|
},
|
|
20
23
|
'& .RaEdit-main': {
|
|
21
24
|
marginTop: 0
|
|
@@ -16,11 +16,11 @@ const StyledGrid = styled(Grid, {
|
|
|
16
16
|
// Other toolbars must be handled outside this rule.
|
|
17
17
|
'& .MuiToolbar-root.RaToolbar-desktopToolbar': {
|
|
18
18
|
position: 'initial',
|
|
19
|
-
marginTop: theme.spacing(2.5),
|
|
19
|
+
// marginTop: theme.spacing(2.5),
|
|
20
20
|
marginLeft: `-${theme.spacing(3)}`,
|
|
21
21
|
marginRight: `-${theme.spacing(3)}`,
|
|
22
22
|
marginBottom: `-${theme.spacing(2)}`,
|
|
23
|
-
borderTop: `1px solid ${theme.palette.divider}`,
|
|
23
|
+
// borderTop: `1px solid ${theme.palette.divider}`,
|
|
24
24
|
paddingTop: theme.spacing(2.5),
|
|
25
25
|
paddingBottom: theme.spacing(2.5),
|
|
26
26
|
[theme.breakpoints.down('sm')]: {
|
|
@@ -29,6 +29,13 @@ const StyledGrid = styled(Grid, {
|
|
|
29
29
|
marginRight: 0
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
'& .RaToolbar-mobileToolbar': {
|
|
33
|
+
position: 'initial !important',
|
|
34
|
+
paddingTop: '20px !important',
|
|
35
|
+
paddingLeft: '0 !important',
|
|
36
|
+
paddingRight: '0 !important',
|
|
37
|
+
paddingBottom: '0 !important',
|
|
38
|
+
},
|
|
32
39
|
'& form > .MuiToolbar-root': {
|
|
33
40
|
// This is really important: this rule is used to insert forms inside other forms, avoiding
|
|
34
41
|
// the toolbar of the inner form to receive the styles of the previous rule (which generates a strange padding).
|
|
@@ -15,9 +15,9 @@ const StyledSimpleForm = styled(RaSimpleForm, { slot: 'Root' })(({ theme, modal
|
|
|
15
15
|
'& .MuiGrid-root.MuiGrid-container': {
|
|
16
16
|
paddingBottom: theme.spacing(modal ? 0 : 2.5)
|
|
17
17
|
} as any,
|
|
18
|
-
[theme.breakpoints.down('sm')]: {
|
|
19
|
-
|
|
20
|
-
}
|
|
18
|
+
// [theme.breakpoints.down('sm')]: {
|
|
19
|
+
paddingBottom: '0 !important',
|
|
20
|
+
// }
|
|
21
21
|
}));
|
|
22
22
|
|
|
23
23
|
export type SimpleFormProps = RaSimpleFormProps & {
|
|
@@ -161,8 +161,8 @@ export function RawTableFormIterator(props: TableFormIteratorProps): ReactElemen
|
|
|
161
161
|
sx={
|
|
162
162
|
inset === true
|
|
163
163
|
? {
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
borderRadius: 0
|
|
165
|
+
}
|
|
166
166
|
: { mt: 2, border: `1px solid ${tableBorderColor}` }
|
|
167
167
|
}
|
|
168
168
|
>
|
|
@@ -277,8 +277,9 @@ function AddTableRow(props: any): JSX.Element {
|
|
|
277
277
|
export const TableFormIterator = styled(RawTableFormIterator, { slot: 'Root' })(({ theme }) => ({
|
|
278
278
|
'& > div.MuiPaper-root': {
|
|
279
279
|
overflowX: 'auto',
|
|
280
|
+
// this decision has been made with Roberto in order to avoid Marco gets angry
|
|
280
281
|
[theme.breakpoints.down('sm')]: {
|
|
281
|
-
width: `calc(100vw - ${theme.spacing(8)})`
|
|
282
|
+
width: `calc(100vw - ${theme.spacing(8.25)})`
|
|
282
283
|
}
|
|
283
284
|
},
|
|
284
285
|
[theme.breakpoints.down('sm')]: {
|