@applica-software-guru/react-admin 1.4.188 → 1.4.191
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 +5 -1
- package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -1
- package/dist/index.d.ts +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 +98 -90
- 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 +6 -1
- package/src/index.jsx +1 -0
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>
|
|
@@ -154,6 +154,10 @@ export type CreateInDialogButtonProps = {
|
|
|
154
154
|
className?: string;
|
|
155
155
|
sx?: SxProps;
|
|
156
156
|
children: React.ReactElement;
|
|
157
|
+
/**
|
|
158
|
+
* If set to false, the button will always render as a regular button, regardless of the screen size.
|
|
159
|
+
*/
|
|
160
|
+
fab: boolean;
|
|
157
161
|
onSubmit?: (record: any, close: () => void) => void;
|
|
158
162
|
onSuccess?: (data: any) => void;
|
|
159
163
|
onError?: (error: any) => void;
|
|
@@ -171,6 +175,7 @@ export function CreateInDialogButton({
|
|
|
171
175
|
scrollToTop = true,
|
|
172
176
|
className,
|
|
173
177
|
sx,
|
|
178
|
+
fab = true,
|
|
174
179
|
onSubmit,
|
|
175
180
|
onSuccess,
|
|
176
181
|
onError,
|
|
@@ -183,7 +188,7 @@ export function CreateInDialogButton({
|
|
|
183
188
|
|
|
184
189
|
const handleOpen = useCallback(() => openDialog(resource, () => setOpen(true)), [openDialog, resource]);
|
|
185
190
|
const handleClose = useCallback(() => closeDialog(resource, () => setOpen(false)), [closeDialog, resource]);
|
|
186
|
-
const isSmall = useMediaQuery((theme: Theme) => theme.breakpoints.down('md'));
|
|
191
|
+
const isSmall = fab && useMediaQuery((theme: Theme) => theme.breakpoints.down('md'));
|
|
187
192
|
return (
|
|
188
193
|
<>
|
|
189
194
|
{isSmall ? (
|