@applica-software-guru/react-admin 1.4.189 → 1.4.192
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/ActionsMenu.d.ts.map +1 -1
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts +6 -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/react-admin.cjs.js +5 -5
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +55 -36
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +2 -2
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ActionsMenu.tsx +9 -7
- package/src/components/ra-buttons/CreateInDialogButton.tsx +17 -3
- package/src/components/ra-buttons/EditInDialogButton.tsx +7 -2
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ const StyledMenuPopover = styled(MenuPopover, {
|
|
|
17
17
|
'& .MuiMenuItem-root': {
|
|
18
18
|
padding: 0,
|
|
19
19
|
margin: 0,
|
|
20
|
-
backgroundColor: theme.palette.background.paper,
|
|
20
|
+
// backgroundColor: theme.palette.background.paper,
|
|
21
21
|
'& .MuiButton-startIcon': {
|
|
22
22
|
marginRight: theme.spacing(0)
|
|
23
23
|
}
|
|
@@ -74,6 +74,8 @@ export function ActionsMenu({ horizontal = false, children }: ActionsMenuProps):
|
|
|
74
74
|
}
|
|
75
75
|
}, []);
|
|
76
76
|
|
|
77
|
+
const btnAdditionalStyles = { width: '100%', justifyContent: 'flex-start' };
|
|
78
|
+
|
|
77
79
|
return (
|
|
78
80
|
<StyledRoot>
|
|
79
81
|
<IconButton aria-label="more" aria-haspopup="true" onClick={handleClick} color={open ? 'inherit' : 'default'}>
|
|
@@ -82,12 +84,12 @@ export function ActionsMenu({ horizontal = false, children }: ActionsMenuProps):
|
|
|
82
84
|
<StyledMenuPopover open={open} onClose={handleClose} arrow="right-top">
|
|
83
85
|
{Children.map(
|
|
84
86
|
children,
|
|
85
|
-
(action, index) =>
|
|
86
|
-
React.
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
(action, index) => React.isValidElement(action) && <MenuItem onClick={handleOnClick} key={index}>
|
|
88
|
+
{React.cloneElement(action,
|
|
89
|
+
{ // @ts-ignore
|
|
90
|
+
style: { ...btnAdditionalStyles }
|
|
91
|
+
})}
|
|
92
|
+
</MenuItem>
|
|
91
93
|
)}
|
|
92
94
|
</StyledMenuPopover>
|
|
93
95
|
</StyledRoot>
|
|
@@ -153,7 +153,12 @@ export type CreateInDialogButtonProps = {
|
|
|
153
153
|
scrollToTop?: boolean;
|
|
154
154
|
className?: string;
|
|
155
155
|
sx?: SxProps;
|
|
156
|
+
style?: React.CSSProperties;
|
|
156
157
|
children: React.ReactElement;
|
|
158
|
+
/**
|
|
159
|
+
* If set to false, the button will always render as a regular button, regardless of the screen size.
|
|
160
|
+
*/
|
|
161
|
+
fab: boolean;
|
|
157
162
|
onSubmit?: (record: any, close: () => void) => void;
|
|
158
163
|
onSuccess?: (data: any) => void;
|
|
159
164
|
onError?: (error: any) => void;
|
|
@@ -171,6 +176,8 @@ export function CreateInDialogButton({
|
|
|
171
176
|
scrollToTop = true,
|
|
172
177
|
className,
|
|
173
178
|
sx,
|
|
179
|
+
style,
|
|
180
|
+
fab = true,
|
|
174
181
|
onSubmit,
|
|
175
182
|
onSuccess,
|
|
176
183
|
onError,
|
|
@@ -183,7 +190,7 @@ export function CreateInDialogButton({
|
|
|
183
190
|
|
|
184
191
|
const handleOpen = useCallback(() => openDialog(resource, () => setOpen(true)), [openDialog, resource]);
|
|
185
192
|
const handleClose = useCallback(() => closeDialog(resource, () => setOpen(false)), [closeDialog, resource]);
|
|
186
|
-
const isSmall = useMediaQuery((theme: Theme) => theme.breakpoints.down('md'));
|
|
193
|
+
const isSmall = fab && useMediaQuery((theme: Theme) => theme.breakpoints.down('md'));
|
|
187
194
|
return (
|
|
188
195
|
<>
|
|
189
196
|
{isSmall ? (
|
|
@@ -199,14 +206,21 @@ export function CreateInDialogButton({
|
|
|
199
206
|
<PlusCircleOutlined />
|
|
200
207
|
</StyledFab>
|
|
201
208
|
) : (
|
|
202
|
-
<Button {...props} sx={sx} label={label} onClick={handleOpen}>
|
|
209
|
+
<Button {...props} sx={sx} label={label} onClick={handleOpen} style={style}>
|
|
203
210
|
<PlusCircleOutlined />
|
|
204
211
|
</Button>
|
|
205
212
|
)}
|
|
206
213
|
<Dialog
|
|
207
214
|
open={open}
|
|
208
215
|
scroll="body"
|
|
209
|
-
sx={{
|
|
216
|
+
sx={{
|
|
217
|
+
'& .MuiToolbar-root': {
|
|
218
|
+
position: 'initial',
|
|
219
|
+
paddingLeft: 2.5,
|
|
220
|
+
paddingRight: 2.5,
|
|
221
|
+
paddingBottom: 2.5,
|
|
222
|
+
}
|
|
223
|
+
}}
|
|
210
224
|
onClose={handleClose}
|
|
211
225
|
fullWidth={fullWidth}
|
|
212
226
|
maxWidth={maxWidth}
|
|
@@ -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);
|
|
@@ -88,7 +90,7 @@ export function EditInDialogButton({
|
|
|
88
90
|
|
|
89
91
|
return (
|
|
90
92
|
<>
|
|
91
|
-
<Button label={label} onClick={handleOpen}>
|
|
93
|
+
<Button label={label} onClick={handleOpen} style={style}>
|
|
92
94
|
<Edit />
|
|
93
95
|
</Button>
|
|
94
96
|
<Dialog
|
|
@@ -96,7 +98,10 @@ export function EditInDialogButton({
|
|
|
96
98
|
scroll="body"
|
|
97
99
|
sx={{
|
|
98
100
|
'& .MuiToolbar-root': {
|
|
99
|
-
position: 'initial'
|
|
101
|
+
position: 'initial',
|
|
102
|
+
paddingLeft: 2.5,
|
|
103
|
+
paddingRight: 2.5,
|
|
104
|
+
paddingBottom: 2.5,
|
|
100
105
|
}
|
|
101
106
|
}}
|
|
102
107
|
onClose={handleClose}
|