@applica-software-guru/react-admin 1.3.184 → 1.4.0-beta.0

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.
Files changed (117) hide show
  1. package/bitbucket-pipelines.yml +3 -3
  2. package/dist/components/ActionsMenu.d.ts +3 -16
  3. package/dist/components/ActionsMenu.d.ts.map +1 -1
  4. package/dist/components/MenuPopover/MenuPopover.d.ts.map +1 -1
  5. package/dist/components/MenuPopover/styles.d.ts.map +1 -1
  6. package/dist/components/ra-buttons/CreateInDialogButton.d.ts +6 -1
  7. package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -1
  8. package/dist/components/ra-buttons/EditInDialogButton.d.ts +2 -1
  9. package/dist/components/ra-buttons/EditInDialogButton.d.ts.map +1 -1
  10. package/dist/components/ra-custom/ListItem.d.ts +3 -6
  11. package/dist/components/ra-custom/ListItem.d.ts.map +1 -1
  12. package/dist/components/ra-fields/BaseAttachmentField.d.ts.map +1 -1
  13. package/dist/components/ra-fields/DateField.d.ts.map +1 -1
  14. package/dist/components/ra-fields/EmailField.d.ts.map +1 -1
  15. package/dist/components/ra-fields/FileField.d.ts.map +1 -1
  16. package/dist/components/ra-fields/ImageField.d.ts.map +1 -1
  17. package/dist/components/ra-fields/ReferenceManyField.d.ts +0 -3
  18. package/dist/components/ra-fields/ReferenceManyField.d.ts.map +1 -1
  19. package/dist/components/ra-fields/TextField.d.ts.map +1 -1
  20. package/dist/components/ra-forms/CardForm.d.ts.map +1 -1
  21. package/dist/components/ra-forms/Create.d.ts.map +1 -1
  22. package/dist/components/ra-forms/Edit.d.ts +2 -24
  23. package/dist/components/ra-forms/Edit.d.ts.map +1 -1
  24. package/dist/components/ra-forms/LongForm/BaseForm.d.ts.map +1 -1
  25. package/dist/components/ra-forms/Show.d.ts +2 -1
  26. package/dist/components/ra-forms/Show.d.ts.map +1 -1
  27. package/dist/components/ra-forms/SimpleForm.d.ts.map +1 -1
  28. package/dist/components/ra-forms/SimpleFormIterator.d.ts +1 -1
  29. package/dist/components/ra-forms/SimpleFormIterator.d.ts.map +1 -1
  30. package/dist/components/ra-forms/TabbedForm.d.ts.map +1 -1
  31. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts +0 -3
  32. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts.map +1 -1
  33. package/dist/components/ra-forms/Toolbar.d.ts.map +1 -1
  34. package/dist/components/ra-forms/index.d.ts +1 -0
  35. package/dist/components/ra-forms/index.d.ts.map +1 -1
  36. package/dist/components/ra-inputs/ArrayInput.d.ts +2 -5
  37. package/dist/components/ra-inputs/ArrayInput.d.ts.map +1 -1
  38. package/dist/components/ra-inputs/AttachmentInput.d.ts +0 -3
  39. package/dist/components/ra-inputs/AttachmentInput.d.ts.map +1 -1
  40. package/dist/components/ra-inputs/BooleanInput.d.ts.map +1 -1
  41. package/dist/components/ra-inputs/DateInput.d.ts.map +1 -1
  42. package/dist/components/ra-inputs/DateTimeInput.d.ts.map +1 -1
  43. package/dist/components/ra-inputs/FileInput.d.ts.map +1 -1
  44. package/dist/components/ra-inputs/NumberInput.d.ts.map +1 -1
  45. package/dist/components/ra-inputs/SearchInput.d.ts.map +1 -1
  46. package/dist/components/ra-inputs/SelectArrayInput.d.ts.map +1 -1
  47. package/dist/components/ra-inputs/SelectInput.d.ts.map +1 -1
  48. package/dist/components/ra-inputs/TimeInput.d.ts.map +1 -1
  49. package/dist/components/ra-lists/Datagrid/Datagrid.d.ts +1 -1
  50. package/dist/components/ra-lists/Datagrid/Datagrid.d.ts.map +1 -1
  51. package/dist/components/ra-lists/Datagrid/index.d.ts.map +1 -1
  52. package/dist/components/ra-lists/List.d.ts.map +1 -1
  53. package/dist/components/ra-lists/SimpleList.d.ts +2 -2
  54. package/dist/components/ra-lists/SimpleList.d.ts.map +1 -1
  55. package/dist/hooks/index.d.ts +1 -0
  56. package/dist/hooks/index.d.ts.map +1 -1
  57. package/dist/hooks/useApplicaAuthProvider.d.ts +3 -0
  58. package/dist/hooks/useApplicaAuthProvider.d.ts.map +1 -0
  59. package/dist/hooks/useMemoizedObject.d.ts +3 -5
  60. package/dist/hooks/useMemoizedObject.d.ts.map +1 -1
  61. package/dist/hooks/useResourceTitle.d.ts +7 -1
  62. package/dist/hooks/useResourceTitle.d.ts.map +1 -1
  63. package/dist/index.d.ts +1 -1
  64. package/dist/react-admin.cjs.js +66 -82
  65. package/dist/react-admin.cjs.js.map +1 -1
  66. package/dist/react-admin.es.js +10426 -10082
  67. package/dist/react-admin.es.js.map +1 -1
  68. package/dist/react-admin.umd.js +67 -83
  69. package/dist/react-admin.umd.js.map +1 -1
  70. package/index.html +5 -0
  71. package/package.json +5 -5
  72. package/src/components/ActionsMenu.tsx +20 -20
  73. package/src/components/Layout/Provider.tsx +3 -3
  74. package/src/components/MenuPopover/MenuPopover.jsx +1 -0
  75. package/src/components/MenuPopover/styles.jsx +7 -3
  76. package/src/components/ra-buttons/CreateInDialogButton.tsx +19 -13
  77. package/src/components/ra-buttons/EditInDialogButton.tsx +9 -4
  78. package/src/components/ra-custom/ListItem.tsx +3 -6
  79. package/src/components/ra-fields/BaseAttachmentField.tsx +1 -6
  80. package/src/components/ra-fields/DateField.tsx +1 -4
  81. package/src/components/ra-fields/EmailField.tsx +1 -4
  82. package/src/components/ra-fields/FileField.tsx +1 -4
  83. package/src/components/ra-fields/ImageField.tsx +1 -4
  84. package/src/components/ra-fields/ReferenceManyField.tsx +1 -7
  85. package/src/components/ra-fields/TextField.tsx +1 -4
  86. package/src/components/ra-forms/CardForm.tsx +10 -6
  87. package/src/components/ra-forms/Create.tsx +8 -5
  88. package/src/components/ra-forms/Edit.tsx +12 -7
  89. package/src/components/ra-forms/LongForm/BaseForm.tsx +11 -4
  90. package/src/components/ra-forms/Show.tsx +18 -19
  91. package/src/components/ra-forms/SimpleForm.tsx +5 -8
  92. package/src/components/ra-forms/SimpleFormIterator.tsx +24 -26
  93. package/src/components/ra-forms/TabbedForm.tsx +5 -5
  94. package/src/components/ra-forms/TableForm/TableFormIterator.tsx +5 -10
  95. package/src/components/ra-forms/Toolbar.tsx +1 -4
  96. package/src/components/ra-forms/index.ts +1 -0
  97. package/src/components/ra-inputs/ArrayInput.tsx +3 -9
  98. package/src/components/ra-inputs/AttachmentInput.tsx +1 -7
  99. package/src/components/ra-inputs/BooleanInput.tsx +1 -4
  100. package/src/components/ra-inputs/DateInput.tsx +1 -4
  101. package/src/components/ra-inputs/DateTimeInput.tsx +1 -4
  102. package/src/components/ra-inputs/FileInput.tsx +1 -4
  103. package/src/components/ra-inputs/NumberInput.tsx +1 -4
  104. package/src/components/ra-inputs/SearchInput.tsx +1 -4
  105. package/src/components/ra-inputs/SelectArrayInput.tsx +1 -4
  106. package/src/components/ra-inputs/SelectInput.tsx +2 -5
  107. package/src/components/ra-inputs/TimeInput.tsx +1 -4
  108. package/src/components/ra-lists/Datagrid/Datagrid.tsx +33 -71
  109. package/src/components/ra-lists/Datagrid/index.tsx +1 -4
  110. package/src/components/ra-lists/List.tsx +1 -4
  111. package/src/hooks/index.ts +1 -0
  112. package/src/hooks/useApplicaAuthProvider.js +8 -0
  113. package/src/hooks/useMemoizedObject.tsx +3 -5
  114. package/src/hooks/{useResourceTitle.jsx → useResourceTitle.ts} +8 -2
  115. package/src/index.jsx +1 -0
  116. package/src/playground/types.ts +16 -18
  117. package/vite.config.js +3 -4
package/index.html CHANGED
@@ -7,6 +7,11 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
9
9
  <title>React-Admin Demo Application</title>
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" />
11
+ <link
12
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap&family=Public+Sans:wght@400;500;600;700"
13
+ rel="stylesheet"
14
+ />
10
15
  </head>
11
16
  <body>
12
17
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.3.184",
3
+ "version": "1.4.0-beta.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -58,10 +58,10 @@
58
58
  "dayjs": "^1.11.8",
59
59
  "framer-motion": "^10.12.17",
60
60
  "history": "^5.1.0",
61
- "ra-core": "^4.14.5",
62
- "ra-i18n-polyglot": "^4.14.1",
63
- "ra-ui-materialui": "4.14.5",
64
- "react-admin": "4.14.5",
61
+ "ra-core": "4.16.16",
62
+ "ra-i18n-polyglot": "4.16.16",
63
+ "ra-ui-materialui": "4.16.16",
64
+ "react-admin": "4.16.16",
65
65
  "react-device-detect": "^2.2.3",
66
66
  "react-hook-form": "^7.43.9",
67
67
  "react-router": "^6.1.0",
@@ -1,9 +1,7 @@
1
1
  import { IconButton, MenuItem, styled } from '@mui/material';
2
- import React, { Children, useCallback, useState } from 'react';
3
-
4
- import MenuPopover from './MenuPopover/MenuPopover';
5
2
  import { MoreHoriz, MoreVert } from '@mui/icons-material';
6
- import PropTypes from 'prop-types';
3
+ import MenuPopover from './MenuPopover/MenuPopover';
4
+ import React, { Children, useCallback, useState } from 'react';
7
5
 
8
6
  const StyledRoot = styled('div', {
9
7
  shouldForwardProp: (prop) => prop !== 'color' && prop !== 'variant' && prop !== 'sx',
@@ -14,42 +12,42 @@ const StyledRoot = styled('div', {
14
12
  }));
15
13
 
16
14
  const StyledMenuPopover = styled(MenuPopover, {
17
- name: 'ApplicaActionsMenu',
18
15
  slot: 'root'
19
16
  })(({ theme }) => ({
20
17
  '& .MuiMenuItem-root': {
21
18
  padding: 0,
22
19
  margin: 0,
23
- backgroundColor: theme.palette.background.paper,
20
+ // backgroundColor: theme.palette.background.paper,
24
21
  '& .MuiButton-startIcon': {
25
22
  marginRight: theme.spacing(0)
26
23
  }
27
24
  }
28
25
  }));
26
+
29
27
  export type ActionsMenuProps = {
30
28
  children: React.ReactNode;
31
29
  horizontal?: boolean;
32
30
  };
33
31
 
34
32
  /**
35
- * Consente di disegnare un menu di azioni raggruppate all'interno di un popover.
36
- * All'interno del menu è possibile inserire uno o più componenti che, è suggeribile, siano bottoni.
33
+ * Allows you to draw a menu of actions grouped within a popover.
34
+ * Inside the menu you can insert one or more components that, it is advisable, are buttons.
37
35
  *
38
36
  * @example
39
37
  * <ActionsMenu>
40
38
  * <DeleteButton />
41
39
  * <EditButton />
42
40
  * </ActionsMenu>
43
- *
44
- * @param {ActionsMenuProps}
45
- * @returns {React.ReactElement}
46
41
  */
47
- const ActionsMenu = ({ horizontal = false, children }: ActionsMenuProps): React.ReactElement | null => {
42
+ export function ActionsMenu({ horizontal = false, children }: ActionsMenuProps): React.ReactElement | null {
48
43
  const [open, setOpen] = useState(null);
44
+ const actionRef = React.useRef(null);
45
+
49
46
  const handleClick = (e: any) => {
50
47
  e.stopPropagation();
51
48
  e.preventDefault();
52
49
  setOpen(e.currentTarget);
50
+ actionRef.current = e.currentTarget;
53
51
  };
54
52
  const handleClose = useCallback((e: any) => {
55
53
  e.stopPropagation();
@@ -72,10 +70,12 @@ const ActionsMenu = ({ horizontal = false, children }: ActionsMenuProps): React.
72
70
  setOpen(null);
73
71
 
74
72
  if (typeof e.currentTarget?.onClick === 'function') {
75
- e.currentTarget.onClick();
73
+ e.currentTarget.onClick(e);
76
74
  }
77
75
  }, []);
78
76
 
77
+ const btnAdditionalStyles = { width: '100%', justifyContent: 'flex-start' };
78
+
79
79
  return (
80
80
  <StyledRoot>
81
81
  <IconButton aria-label="more" aria-haspopup="true" onClick={handleClick} color={open ? 'inherit' : 'default'}>
@@ -84,16 +84,16 @@ const ActionsMenu = ({ horizontal = false, children }: ActionsMenuProps): React.
84
84
  <StyledMenuPopover open={open} onClose={handleClose} arrow="right-top">
85
85
  {Children.map(
86
86
  children,
87
- (action, index) => React.isValidElement(action) && <MenuItem onClick={handleOnClick} key={index}>{React.cloneElement(action)}</MenuItem>
87
+ (action, index) => React.isValidElement(action) && <MenuItem onClick={handleOnClick} key={index}>
88
+ {React.cloneElement(action,
89
+ { // @ts-ignore
90
+ style: { ...btnAdditionalStyles }
91
+ })}
92
+ </MenuItem>
88
93
  )}
89
94
  </StyledMenuPopover>
90
95
  </StyledRoot>
91
96
  );
92
- };
93
-
94
- ActionsMenu.propTypes = {
95
- ...MenuPopover.propTypes,
96
- children: PropTypes.node.isRequired
97
- };
97
+ }
98
98
 
99
99
  export default ActionsMenu;
@@ -1,7 +1,7 @@
1
1
  import { Dialog, useMediaQuery, useTheme } from '@mui/material';
2
- import { UseGetIdentityResult, useGetIdentity, useAuthProvider } from 'ra-core';
2
+ import { UseGetIdentityResult, useGetIdentity } from 'ra-core';
3
3
  import { createContext, forwardRef, useCallback, useContext, useEffect, useMemo, useReducer, useState } from 'react';
4
- import { useMenuConfig, useThemeConfig } from '../../hooks';
4
+ import { useApplicaAuthProvider, useMenuConfig, useThemeConfig } from '../../hooks';
5
5
 
6
6
  import { ChangePasswordForm } from '../ra-forms';
7
7
  import _ from 'lodash';
@@ -130,7 +130,7 @@ const DefaultState: ILayoutState = {
130
130
  LayoutContext = createContext<ILayoutContext | undefined>(undefined);
131
131
 
132
132
  function LayoutProvider(props: ILayoutProviderProps) {
133
- const authProvider = useAuthProvider();
133
+ const authProvider = useApplicaAuthProvider();
134
134
  const identity = useGetIdentity() as UseGetIdentityResult,
135
135
  theme = useTheme(),
136
136
  downMd = useMediaQuery(theme.breakpoints.down('md')),
@@ -13,6 +13,7 @@ const MenuPopover = ({ open, children, arrow = 'top-right', disabledArrow, sx, .
13
13
  anchorEl={open}
14
14
  anchorOrigin={anchorOrigin}
15
15
  transformOrigin={transformOrigin}
16
+ keepMounted
16
17
  PaperProps={{
17
18
  sx: {
18
19
  p: 1,
@@ -5,7 +5,8 @@ export const StyledArrow = styled('span')(({ arrow, theme }) => {
5
5
 
6
6
  const POSITION = -(SIZE / 2);
7
7
 
8
- const borderStyle = `solid 1px ${alpha(theme.palette.grey[500], 0.12)}`;
8
+ const borderStyle =
9
+ theme.palette.mode === 'dark' ? `solid 1px ${theme.palette.grey[100]}` : `solid 1px ${alpha(theme.palette.grey[500], 0.12)}`;
9
10
 
10
11
  const topStyle = {
11
12
  borderRadius: '0 0 3px 0',
@@ -30,7 +31,7 @@ export const StyledArrow = styled('span')(({ arrow, theme }) => {
30
31
 
31
32
  const rightStyle = {
32
33
  borderRadius: '0 0 0 3px',
33
- right: POSITION,
34
+ right: POSITION - 1,
34
35
  borderBottom: borderStyle,
35
36
  borderLeft: borderStyle
36
37
  };
@@ -45,7 +46,10 @@ export const StyledArrow = styled('span')(({ arrow, theme }) => {
45
46
  display: 'block',
46
47
  position: 'absolute',
47
48
  transform: 'rotate(-135deg)',
48
- background: theme.palette.background.paper
49
+ background: theme.palette.background.paper,
50
+ backgroundImage: 'inherit',
51
+ borderLeft: borderStyle,
52
+ borderBottom: borderStyle
49
53
  },
50
54
  // Top
51
55
  ...(arrow === 'top-left' && { ...topStyle, left: 20 }),
@@ -11,11 +11,10 @@ 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
-
18
- import { Add } from '@mui/icons-material';
17
+ import { PlusCircleOutlined } from '@ant-design/icons';
19
18
  import { Toolbar } from '../ra-forms';
20
19
  import clsx from 'clsx';
21
20
  import { useAppConfig } from '../../hooks';
@@ -119,7 +118,7 @@ const CreateInDialogContent = ({
119
118
  toolbar: (
120
119
  <Toolbar>
121
120
  <Button variant="text" size="medium" label="ra.action.cancel" onClick={onClose} disabled={createProps?.saving} />
122
- <SaveButton disabled={createProps?.saving} />
121
+ <SaveButton type="button" disabled={createProps?.saving} />
123
122
  </Toolbar>
124
123
  )
125
124
  })}
@@ -132,10 +131,7 @@ const scrollStates = {
132
131
  false: {}
133
132
  } as any;
134
133
 
135
- const StyledFab = styled(Fab, {
136
- name: 'RaApplicaCreateInDialogButton',
137
- overridesResolver: (_props, styles) => styles.root
138
- })(({ theme }) => ({
134
+ const StyledFab = styled(Fab, { overridesResolver: (_props, styles) => styles.root })(({ theme }) => ({
139
135
  [`&.${CreateButtonClasses.floating}`]: {
140
136
  color: theme.palette.getContrastText(theme.palette.primary.main),
141
137
  margin: 0,
@@ -157,7 +153,12 @@ export type CreateInDialogButtonProps = {
157
153
  scrollToTop?: boolean;
158
154
  className?: string;
159
155
  sx?: SxProps;
156
+ style?: React.CSSProperties;
160
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;
161
162
  onSubmit?: (record: any, close: () => void) => void;
162
163
  onSuccess?: (data: any) => void;
163
164
  onError?: (error: any) => void;
@@ -175,6 +176,8 @@ export function CreateInDialogButton({
175
176
  scrollToTop = true,
176
177
  className,
177
178
  sx,
179
+ style,
180
+ fab = true,
178
181
  onSubmit,
179
182
  onSuccess,
180
183
  onError,
@@ -184,10 +187,11 @@ export function CreateInDialogButton({
184
187
  const translate = useTranslate();
185
188
  const resource = useResourceContext();
186
189
  const { openDialog, closeDialog } = useAppConfig();
190
+ const theme = useTheme();
187
191
 
188
192
  const handleOpen = useCallback(() => openDialog(resource, () => setOpen(true)), [openDialog, resource]);
189
193
  const handleClose = useCallback(() => closeDialog(resource, () => setOpen(false)), [closeDialog, resource]);
190
- const isSmall = useMediaQuery((theme: Theme) => theme.breakpoints.down('md'));
194
+ const isSmall = fab && useMediaQuery((theme: Theme) => theme.breakpoints.down('md'));
191
195
  return (
192
196
  <>
193
197
  {isSmall ? (
@@ -200,11 +204,11 @@ export function CreateInDialogButton({
200
204
  aria-label={label && translate(label)}
201
205
  onClick={handleOpen}
202
206
  >
203
- <Add />
207
+ <PlusCircleOutlined />
204
208
  </StyledFab>
205
209
  ) : (
206
- <Button {...props} sx={sx} label={label} onClick={handleOpen}>
207
- <Add />
210
+ <Button {...props} sx={sx} label={label} onClick={handleOpen} style={style}>
211
+ <PlusCircleOutlined />
208
212
  </Button>
209
213
  )}
210
214
  <Dialog
@@ -212,7 +216,9 @@ export function CreateInDialogButton({
212
216
  scroll="body"
213
217
  sx={{
214
218
  '& .MuiToolbar-root': {
215
- position: 'initial'
219
+ borderTop: `1px solid ${theme.palette.divider}`,
220
+ position: 'initial',
221
+ padding: 2.5
216
222
  }
217
223
  }}
218
224
  onClose={handleClose}
@@ -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';
@@ -59,7 +59,7 @@ const EditInDialogContent = ({ onClose, children }: EditInDialogContentProps) =>
59
59
  toolbar: (
60
60
  <Toolbar>
61
61
  <Button variant="text" size="medium" label="ra.action.cancel" onClick={onClose} />
62
- <SaveButton />
62
+ <SaveButton type="button" />
63
63
  </Toolbar>
64
64
  )
65
65
  })}
@@ -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
- position: 'initial'
102
+ borderTop: `1px solid ${theme.palette.divider}`,
103
+ position: 'initial',
104
+ padding: 2.5
100
105
  }
101
106
  }}
102
107
  onClose={handleClose}
@@ -38,12 +38,9 @@ const defaultIconStyle = {
38
38
  };
39
39
 
40
40
  /**
41
- * Implementa il componente ListItem progettato e disegnato da Applica.
42
- * Questo componente può essere utilizzato in diverse combinazioni di proprietà e consente di visualizzare e/o modificare dati
43
- * aggiungendo elementi decorativi di dettagli e personalizzazioni nella formattazione dei dati.
44
- *
45
- * @param {ListItemProps} props
46
- * @returns {JSX.Element}
41
+ * Implements the ListItem component designed and drawn by Applica.
42
+ * This component can be used in different combinations of properties and allows you to view and/or modify data
43
+ * by adding decorative elements of details and customizations in data formatting.
47
44
  */
48
45
  export function ListItem({
49
46
  source,
@@ -3,12 +3,7 @@ import { Typography } from '@mui/material';
3
3
  import { get } from 'lodash';
4
4
  import { styled } from '@mui/material/styles';
5
5
 
6
- const Root = styled('div', {
7
- name: 'ApplicaBaseAttachmentField',
8
- overridesResolver: (props, styles) => styles.root
9
- })({
10
- display: 'inline-block'
11
- });
6
+ const Root = styled('div', { overridesResolver: (props, styles) => styles.root })({ display: 'inline-block' });
12
7
 
13
8
  const StyledList = styled('ul')({
14
9
  display: 'inline-block'
@@ -1,10 +1,7 @@
1
1
  import { DateFieldProps, DateField as RaDateField } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
 
4
- const StyledDateField = styled(RaDateField, {
5
- name: 'RaApplicaDateField',
6
- slot: 'Root'
7
- })(() => ({}));
4
+ const StyledDateField = styled(RaDateField, { slot: 'Root' })(() => ({}));
8
5
 
9
6
  export function DateField({ variant = 'body1', ...props }: DateFieldProps): JSX.Element {
10
7
  // @ts-ignore
@@ -1,10 +1,7 @@
1
1
  import { EmailFieldProps, EmailField as RaEmailField } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
 
4
- const StyledEmailField = styled(RaEmailField, {
5
- name: 'RaApplicaEmailField',
6
- slot: 'Root'
7
- })(() => ({}));
4
+ const StyledEmailField = styled(RaEmailField, { slot: 'Root' })(() => ({}));
8
5
 
9
6
  export function EmailField({ variant = 'body1', ...props }: EmailFieldProps): JSX.Element {
10
7
  return <StyledEmailField {...props} variant={variant} />;
@@ -3,10 +3,7 @@ import { get } from 'lodash';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { useCallback } from 'react';
5
5
 
6
- const StyledFileField = styled(RaFileField, {
7
- name: 'RaApplicaFileField',
8
- slot: 'root'
9
- })(() => ({}));
6
+ const StyledFileField = styled(RaFileField, { slot: 'root' })(() => ({}));
10
7
 
11
8
  export type FileFieldProps = {
12
9
  source: string;
@@ -1,10 +1,7 @@
1
1
  import { ImageFieldProps, ImageField as RaImageField } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
 
4
- const StyledImageField = styled(RaImageField, {
5
- name: 'RaApplicaImageField',
6
- slot: 'root'
7
- })(() => ({}));
4
+ const StyledImageField = styled(RaImageField, { slot: 'root' })(() => ({}));
8
5
 
9
6
  export function ImageField(props: ImageFieldProps): JSX.Element {
10
7
  const source = `_${props?.source}`;
@@ -14,10 +14,7 @@ const StyledDiv = function ({ children = null, className = '' }: StyledDivProps)
14
14
  return <div className={className}>{children}</div>;
15
15
  };
16
16
 
17
- const StyledRoot = styled(StyledDiv, {
18
- name: 'RaApplicaReferenceManyField',
19
- slot: 'root'
20
- })(({ theme, bulkActionButtons }: StyledRootProps) => {
17
+ const StyledRoot = styled(StyledDiv, { slot: 'root' })(({ theme, bulkActionButtons }: StyledRootProps) => {
21
18
  return {
22
19
  marginLeft: `-${theme.spacing(2.5)}`,
23
20
  marginRight: `-${theme.spacing(2.5)}`,
@@ -100,9 +97,6 @@ export type ReferenceManyFieldProps = RaReferenceManyFieldProps & {
100
97
  * ...
101
98
  * </Datagrid>
102
99
  * </ReferenceManyField>
103
- *
104
- * @param props {ReferenceManyFieldProps}
105
- * @returns {JSX.Element}
106
100
  */
107
101
  export function ReferenceManyField(props: ReferenceManyFieldProps): JSX.Element {
108
102
  return (
@@ -1,10 +1,7 @@
1
1
  import { TextField as RaTextField, TextFieldProps } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
 
4
- const StyledTextField = styled(RaTextField, {
5
- name: 'RaApplicaTextField',
6
- slot: 'Root'
7
- })(() => ({}));
4
+ const StyledTextField = styled(RaTextField, { slot: 'Root' })(() => ({}));
8
5
 
9
6
  export function TextField({ variant = 'body1', ...props }: TextFieldProps): JSX.Element {
10
7
  // @ts-ignore
@@ -63,14 +63,18 @@ type StyledFormProps = {
63
63
  theme: any;
64
64
  };
65
65
 
66
- const StyledForm = styled(Form, {
67
- name: 'RaApplicaCardForm',
68
- slot: 'root'
69
- })(({ theme, spacing }: StyledFormProps) => ({
66
+ const StyledForm = styled(Form, { slot: 'root' })(({ theme, spacing }: StyledFormProps) => ({
70
67
  backgroundColor: 'transparent',
71
68
  '& .RaToolbar-desktopToolbar': {
72
- marginTop: theme.spacing((spacing as number) * 2),
73
- 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,
74
78
  }
75
79
  }));
76
80
 
@@ -71,10 +71,7 @@ export function useResourceDefaultValues(): IResourceDefaultValue {
71
71
  return useContext(ResourceDefaultValueContext);
72
72
  }
73
73
 
74
- export const Create = styled(CreateWithDefaults, {
75
- name: 'RaApplicaEdit',
76
- slot: 'root'
77
- })(({ theme }) => ({
74
+ export const Create = styled(CreateWithDefaults, { slot: 'root' })(({ theme }) => ({
78
75
  '& .RaCreate-card, & > div > div > form': {
79
76
  backgroundColor: theme.palette.background.default
80
77
  },
@@ -84,10 +81,16 @@ export const Create = styled(CreateWithDefaults, {
84
81
  '& .RaCreate-main>.MuiPaper-root:first-of-type': {
85
82
  backgroundColor: theme.palette.background.default
86
83
  },
84
+ '& .RaToolbar-mobileToolbar': {
85
+ position: 'initial !important',
86
+ paddingLeft: '20px !important',
87
+ paddingRight: '20px !important',
88
+ paddingTop: '0 !important',
89
+ },
87
90
  // Ci ho messo 4 ore per scrivere questa riga di codice e risolvere un problema con react-sticky-box ed i Long Form.
88
91
  // L'overflow è di default 'hidden', a noi serve visibile per consentire a react-sticky-box di funzionare e gestire la visiblità con ancore
89
92
  // di tutti gli elementi presenti all'interno della pagina.
90
- '& .RaCreate-main:has(.ApplicaLongFormView)>.MuiPaper-root:first-of-type': {
93
+ '& .RaCreate-main:has(.LongFormView)>.MuiPaper-root:first-of-type': {
91
94
  overflow: 'visible'
92
95
  },
93
96
  '& .RaCreate-main:has(.tabbed-form) .MuiTableContainer-root': {
@@ -1,10 +1,7 @@
1
- import { Edit as RaEdit } from 'react-admin';
1
+ import { EditProps, Edit as RaEdit } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
 
4
- export const Edit = styled(RaEdit, {
5
- name: 'RaApplicaEdit',
6
- slot: 'root'
7
- })(({ theme }) => ({
4
+ const StyledEdit = styled(RaEdit, { slot: 'root' })(({ theme }) => ({
8
5
  '&>.MuiToolbar-root:first-of-type': {
9
6
  backgroundColor: theme.palette.background.default
10
7
  },
@@ -18,7 +15,10 @@ export const Edit = styled(RaEdit, {
18
15
  },
19
16
 
20
17
  '& .RaToolbar-mobileToolbar': {
21
- borderTop: `1px solid ${theme.palette.divider}`
18
+ position: 'initial !important',
19
+ paddingLeft: '20px !important',
20
+ paddingRight: '20px !important',
21
+ paddingTop: '0 !important'
22
22
  },
23
23
  '& .RaEdit-main': {
24
24
  marginTop: 0
@@ -29,7 +29,7 @@ export const Edit = styled(RaEdit, {
29
29
  // This line of code took me 4 hours to write and solve a problem with react-sticky-box and Long Forms.
30
30
  // The overflow is 'hidden' by default, we need it to be visible to allow react-sticky-box to work and manage visibility with anchors
31
31
  // of all the elements inside the page.
32
- '& .RaEdit-main:has(.ApplicaLongFormView)>.MuiPaper-root:first-of-type': {
32
+ '& .RaEdit-main:has(.LongFormView)>.MuiPaper-root:first-of-type': {
33
33
  overflow: 'visible'
34
34
  },
35
35
  '& .RaEdit-main:has(.tabbed-form) .MuiTableContainer-root': {
@@ -37,4 +37,9 @@ export const Edit = styled(RaEdit, {
37
37
  }
38
38
  }));
39
39
 
40
+ export function Edit(props: EditProps): JSX.Element {
41
+ // @ts-ignore
42
+ return <StyledEdit {...props} />;
43
+ }
44
+
40
45
  export default Edit;
@@ -9,18 +9,18 @@ type IBaseFormProps = FormProps & {
9
9
  };
10
10
 
11
11
  const StyledGrid = styled(Grid, {
12
- name: 'ApplicaLongFormView',
12
+ name: 'LongFormView',
13
13
  slot: 'Root'
14
14
  })(({ theme }) => ({
15
15
  // This style must be applied only to root toolbars used to save data in the form.
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).
@@ -46,7 +53,7 @@ function BaseForm(props: IBaseFormProps) {
46
53
  formProps = _.omit(props, ['spacing']);
47
54
 
48
55
  return (
49
- <Form {...formProps} className="ApplicaLongFormView">
56
+ <Form {...formProps} className="LongFormView">
50
57
  <StyledGrid container spacing={spacing * 2}>
51
58
  {props.children}
52
59
  </StyledGrid>
@@ -1,24 +1,23 @@
1
- import { Show as RaShow } from 'react-admin';
1
+ import { Show as RaShow, ShowProps } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
 
4
- export function Show(): JSX.Element {
4
+ const StyledShow = styled(RaShow, { slot: 'root' })(({ theme }) => ({
5
+ '&>.MuiToolbar-root:first-of-type': {
6
+ backgroundColor: theme.palette.background.default
7
+ },
8
+ '& .RaShow-card, & > div > div > form': {
9
+ backgroundColor: theme.palette.background.default
10
+ },
11
+ '& .RaShow-main>.MuiPaper-root:first-of-type': {
12
+ // It took me 4 hours to write this line of code and solve a problem with react-sticky-box and Long Forms.
13
+ // The overflow is 'hidden' by default, we need it to be visible to allow react-sticky-box to work and manage visibility with anchors
14
+ // of all the elements inside the page.
15
+ overflow: 'visible'
16
+ }
17
+ }));
18
+
19
+ export function Show(props: ShowProps): JSX.Element {
5
20
  // @ts-ignore
6
- return styled(RaShow, {
7
- name: 'RaApplicaShow',
8
- slot: 'root'
9
- })(({ theme }) => ({
10
- '&>.MuiToolbar-root:first-of-type': {
11
- backgroundColor: theme.palette.background.default
12
- },
13
- '& .RaShow-card, & > div > div > form': {
14
- backgroundColor: theme.palette.background.default
15
- },
16
- '& .RaShow-main>.MuiPaper-root:first-of-type': {
17
- // It took me 4 hours to write this line of code and solve a problem with react-sticky-box and Long Forms.
18
- // The overflow is 'hidden' by default, we need it to be visible to allow react-sticky-box to work and manage visibility with anchors
19
- // of all the elements inside the page.
20
- overflow: 'visible'
21
- }
22
- }));
21
+ return <StyledShow {...props} />;
23
22
  }
24
23
  export default Show;