@applica-software-guru/react-admin 1.4.185 → 1.4.187

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 (91) hide show
  1. package/dist/components/ActionsMenu.d.ts +3 -16
  2. package/dist/components/ActionsMenu.d.ts.map +1 -1
  3. package/dist/components/MenuPopover/MenuPopover.d.ts.map +1 -1
  4. package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +1 -1
  5. package/dist/components/ra-custom/ListItem.d.ts +3 -6
  6. package/dist/components/ra-custom/ListItem.d.ts.map +1 -1
  7. package/dist/components/ra-fields/BaseAttachmentField.d.ts.map +1 -1
  8. package/dist/components/ra-fields/DateField.d.ts.map +1 -1
  9. package/dist/components/ra-fields/EmailField.d.ts.map +1 -1
  10. package/dist/components/ra-fields/FileField.d.ts.map +1 -1
  11. package/dist/components/ra-fields/ImageField.d.ts.map +1 -1
  12. package/dist/components/ra-fields/ReferenceManyField.d.ts +0 -3
  13. package/dist/components/ra-fields/ReferenceManyField.d.ts.map +1 -1
  14. package/dist/components/ra-fields/TextField.d.ts.map +1 -1
  15. package/dist/components/ra-forms/CardForm.d.ts.map +1 -1
  16. package/dist/components/ra-forms/Create.d.ts.map +1 -1
  17. package/dist/components/ra-forms/Edit.d.ts +2 -24
  18. package/dist/components/ra-forms/Edit.d.ts.map +1 -1
  19. package/dist/components/ra-forms/Show.d.ts +2 -1
  20. package/dist/components/ra-forms/Show.d.ts.map +1 -1
  21. package/dist/components/ra-forms/SimpleForm.d.ts.map +1 -1
  22. package/dist/components/ra-forms/SimpleFormIterator.d.ts +1 -1
  23. package/dist/components/ra-forms/SimpleFormIterator.d.ts.map +1 -1
  24. package/dist/components/ra-forms/TabbedForm.d.ts.map +1 -1
  25. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts +0 -3
  26. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts.map +1 -1
  27. package/dist/components/ra-forms/Toolbar.d.ts.map +1 -1
  28. package/dist/components/ra-forms/index.d.ts +1 -0
  29. package/dist/components/ra-forms/index.d.ts.map +1 -1
  30. package/dist/components/ra-inputs/ArrayInput.d.ts +2 -5
  31. package/dist/components/ra-inputs/ArrayInput.d.ts.map +1 -1
  32. package/dist/components/ra-inputs/AttachmentInput.d.ts +0 -3
  33. package/dist/components/ra-inputs/AttachmentInput.d.ts.map +1 -1
  34. package/dist/components/ra-inputs/BooleanInput.d.ts.map +1 -1
  35. package/dist/components/ra-inputs/DateInput.d.ts.map +1 -1
  36. package/dist/components/ra-inputs/DateTimeInput.d.ts.map +1 -1
  37. package/dist/components/ra-inputs/FileInput.d.ts.map +1 -1
  38. package/dist/components/ra-inputs/NumberInput.d.ts.map +1 -1
  39. package/dist/components/ra-inputs/SearchInput.d.ts.map +1 -1
  40. package/dist/components/ra-inputs/SelectArrayInput.d.ts.map +1 -1
  41. package/dist/components/ra-inputs/SelectInput.d.ts.map +1 -1
  42. package/dist/components/ra-inputs/TimeInput.d.ts.map +1 -1
  43. package/dist/components/ra-lists/Datagrid/index.d.ts.map +1 -1
  44. package/dist/components/ra-lists/List.d.ts.map +1 -1
  45. package/dist/hooks/useMemoizedObject.d.ts +3 -5
  46. package/dist/hooks/useMemoizedObject.d.ts.map +1 -1
  47. package/dist/react-admin.cjs.js +66 -66
  48. package/dist/react-admin.cjs.js.map +1 -1
  49. package/dist/react-admin.es.js +10346 -9930
  50. package/dist/react-admin.es.js.map +1 -1
  51. package/dist/react-admin.umd.js +67 -67
  52. package/dist/react-admin.umd.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/components/ActionsMenu.tsx +17 -19
  55. package/src/components/MenuPopover/MenuPopover.jsx +1 -0
  56. package/src/components/ra-buttons/CreateInDialogButton.tsx +6 -14
  57. package/src/components/ra-buttons/EditInDialogButton.tsx +1 -1
  58. package/src/components/ra-custom/ListItem.tsx +3 -6
  59. package/src/components/ra-fields/BaseAttachmentField.tsx +1 -6
  60. package/src/components/ra-fields/DateField.tsx +1 -4
  61. package/src/components/ra-fields/EmailField.tsx +1 -4
  62. package/src/components/ra-fields/FileField.tsx +1 -4
  63. package/src/components/ra-fields/ImageField.tsx +1 -4
  64. package/src/components/ra-fields/ReferenceManyField.tsx +1 -7
  65. package/src/components/ra-fields/TextField.tsx +1 -4
  66. package/src/components/ra-forms/CardForm.tsx +1 -4
  67. package/src/components/ra-forms/Create.tsx +2 -5
  68. package/src/components/ra-forms/Edit.tsx +8 -6
  69. package/src/components/ra-forms/LongForm/BaseForm.tsx +2 -2
  70. package/src/components/ra-forms/Show.tsx +18 -19
  71. package/src/components/ra-forms/SimpleForm.tsx +2 -5
  72. package/src/components/ra-forms/SimpleFormIterator.tsx +24 -26
  73. package/src/components/ra-forms/TabbedForm.tsx +1 -4
  74. package/src/components/ra-forms/TableForm/TableFormIterator.tsx +1 -7
  75. package/src/components/ra-forms/Toolbar.tsx +1 -4
  76. package/src/components/ra-forms/index.ts +1 -0
  77. package/src/components/ra-inputs/ArrayInput.tsx +3 -9
  78. package/src/components/ra-inputs/AttachmentInput.tsx +1 -7
  79. package/src/components/ra-inputs/BooleanInput.tsx +1 -4
  80. package/src/components/ra-inputs/DateInput.tsx +1 -4
  81. package/src/components/ra-inputs/DateTimeInput.tsx +1 -4
  82. package/src/components/ra-inputs/FileInput.tsx +1 -4
  83. package/src/components/ra-inputs/NumberInput.tsx +1 -4
  84. package/src/components/ra-inputs/SearchInput.tsx +1 -4
  85. package/src/components/ra-inputs/SelectArrayInput.tsx +1 -4
  86. package/src/components/ra-inputs/SelectInput.tsx +2 -5
  87. package/src/components/ra-inputs/TimeInput.tsx +1 -4
  88. package/src/components/ra-lists/Datagrid/index.tsx +1 -4
  89. package/src/components/ra-lists/List.tsx +1 -4
  90. package/src/hooks/useMemoizedObject.tsx +3 -5
  91. package/src/playground/types.ts +16 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.4.185",
3
+ "version": "1.4.187",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -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,7 +12,6 @@ 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': {
@@ -26,30 +23,31 @@ const StyledMenuPopover = styled(MenuPopover, {
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,7 +70,7 @@ 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
 
@@ -84,16 +82,16 @@ const ActionsMenu = ({ horizontal = false, children }: ActionsMenuProps): React.
84
82
  <StyledMenuPopover open={open} onClose={handleClose} arrow="right-top">
85
83
  {Children.map(
86
84
  children,
87
- (action, index) => React.isValidElement(action) && <MenuItem onClick={handleOnClick} key={index}>{React.cloneElement(action)}</MenuItem>
85
+ (action, index) =>
86
+ React.isValidElement(action) && (
87
+ <MenuItem onClick={handleOnClick} key={index}>
88
+ {React.cloneElement(action)}
89
+ </MenuItem>
90
+ )
88
91
  )}
89
92
  </StyledMenuPopover>
90
93
  </StyledRoot>
91
94
  );
92
- };
93
-
94
- ActionsMenu.propTypes = {
95
- ...MenuPopover.propTypes,
96
- children: PropTypes.node.isRequired
97
- };
95
+ }
98
96
 
99
97
  export default ActionsMenu;
@@ -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,
@@ -14,8 +14,7 @@ import {
14
14
  import { Dialog, Fab, useMediaQuery } 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,
@@ -200,21 +196,17 @@ export function CreateInDialogButton({
200
196
  aria-label={label && translate(label)}
201
197
  onClick={handleOpen}
202
198
  >
203
- <Add />
199
+ <PlusCircleOutlined />
204
200
  </StyledFab>
205
201
  ) : (
206
202
  <Button {...props} sx={sx} label={label} onClick={handleOpen}>
207
- <Add />
203
+ <PlusCircleOutlined />
208
204
  </Button>
209
205
  )}
210
206
  <Dialog
211
207
  open={open}
212
208
  scroll="body"
213
- sx={{
214
- '& .MuiToolbar-root': {
215
- position: 'initial'
216
- }
217
- }}
209
+ sx={{ '& .MuiToolbar-root': { position: 'initial' } }}
218
210
  onClose={handleClose}
219
211
  fullWidth={fullWidth}
220
212
  maxWidth={maxWidth}
@@ -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
  })}
@@ -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,10 +63,7 @@ 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
69
  marginTop: theme.spacing((spacing as number) * 2),
@@ -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
  },
@@ -87,7 +84,7 @@ export const Create = styled(CreateWithDefaults, {
87
84
  // Ci ho messo 4 ore per scrivere questa riga di codice e risolvere un problema con react-sticky-box ed i Long Form.
88
85
  // L'overflow è di default 'hidden', a noi serve visibile per consentire a react-sticky-box di funzionare e gestire la visiblità con ancore
89
86
  // di tutti gli elementi presenti all'interno della pagina.
90
- '& .RaCreate-main:has(.ApplicaLongFormView)>.MuiPaper-root:first-of-type': {
87
+ '& .RaCreate-main:has(.LongFormView)>.MuiPaper-root:first-of-type': {
91
88
  overflow: 'visible'
92
89
  },
93
90
  '& .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
  },
@@ -29,7 +26,7 @@ export const Edit = styled(RaEdit, {
29
26
  // This line of code took me 4 hours to write and solve a problem with react-sticky-box and Long Forms.
30
27
  // 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
28
  // of all the elements inside the page.
32
- '& .RaEdit-main:has(.ApplicaLongFormView)>.MuiPaper-root:first-of-type': {
29
+ '& .RaEdit-main:has(.LongFormView)>.MuiPaper-root:first-of-type': {
33
30
  overflow: 'visible'
34
31
  },
35
32
  '& .RaEdit-main:has(.tabbed-form) .MuiTableContainer-root': {
@@ -37,4 +34,9 @@ export const Edit = styled(RaEdit, {
37
34
  }
38
35
  }));
39
36
 
37
+ export function Edit(props: EditProps): JSX.Element {
38
+ // @ts-ignore
39
+ return <StyledEdit {...props} />;
40
+ }
41
+
40
42
  export default Edit;
@@ -9,7 +9,7 @@ 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.
@@ -46,7 +46,7 @@ function BaseForm(props: IBaseFormProps) {
46
46
  formProps = _.omit(props, ['spacing']);
47
47
 
48
48
  return (
49
- <Form {...formProps} className="ApplicaLongFormView">
49
+ <Form {...formProps} className="LongFormView">
50
50
  <StyledGrid container spacing={spacing * 2}>
51
51
  {props.children}
52
52
  </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;
@@ -11,10 +11,7 @@ import ActionsMenu from '../ActionsMenu';
11
11
  import MainCard from '../MainCard';
12
12
  import Toolbar from './Toolbar';
13
13
 
14
- const ApplicaStyledSimpleForm = styled(RaSimpleForm, {
15
- name: 'RaApplicaSimpleForm',
16
- slot: 'Root'
17
- })(({ theme, modal }: { theme: any; modal: boolean }) => ({
14
+ const StyledSimpleForm = styled(RaSimpleForm, { slot: 'Root' })(({ theme, modal }: { theme: any; modal: boolean }) => ({
18
15
  '& .MuiGrid-root.MuiGrid-container': {
19
16
  paddingBottom: theme.spacing(modal ? 0 : 2.5)
20
17
  } as any,
@@ -71,7 +68,7 @@ export function SimpleForm({
71
68
  divider
72
69
  >
73
70
  {/* @ts-ignore */}
74
- <ApplicaStyledSimpleForm toolbar={toolbar} {...props} />
71
+ <StyledSimpleForm toolbar={toolbar} {...props} />
75
72
  </MainCard>
76
73
  );
77
74
  }
@@ -1,32 +1,30 @@
1
1
  import { SimpleFormIterator as RaSimpleFormIterator } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
 
4
- export function SimpleFormIterator(): JSX.Element {
5
- // @ts-ignore
6
- return styled(RaSimpleFormIterator, {
7
- name: 'ApplicaSimpleFormIterator',
8
- root: 'root'
9
- })(({ theme }) => ({
10
- '& .RaSimpleFormIterator-line': {
11
- paddingTop: theme.spacing(1),
12
- paddingBottom: theme.spacing(0.5)
13
- },
14
- '& .RaSimpleFormIterator-action': {
15
- display: 'flex',
16
- flexDirection: 'row',
17
- alignItems: 'center',
18
- mb: 1.5
19
- },
20
- '& section': {
21
- width: '100%',
22
- '& label': {
23
- position: 'relative',
24
- overflow: 'visible',
25
- transform: 'none',
26
- marginLeft: 0
27
- }
4
+ // @ts-ignore
5
+ const StyledSimpleFormIterator = styled(RaSimpleFormIterator, { root: 'root' })(({ theme }) => ({
6
+ '& .RaSimpleFormIterator-line': {
7
+ paddingTop: theme.spacing(1),
8
+ paddingBottom: theme.spacing(0.5)
9
+ },
10
+ '& .RaSimpleFormIterator-action': {
11
+ display: 'flex',
12
+ flexDirection: 'row',
13
+ alignItems: 'center',
14
+ mb: 1.5
15
+ },
16
+ '& section': {
17
+ width: '100%',
18
+ '& label': {
19
+ position: 'relative',
20
+ overflow: 'visible',
21
+ transform: 'none',
22
+ marginLeft: 0
28
23
  }
29
- }));
30
- }
24
+ }
25
+ }));
31
26
 
27
+ export function SimpleFormIterator(props: any): JSX.Element {
28
+ return <StyledSimpleFormIterator {...props} />;
29
+ }
32
30
  export default SimpleFormIterator;
@@ -25,10 +25,7 @@ export type TabbedFormProps = RaTabbedFormProps & {
25
25
  noPadding?: boolean;
26
26
  };
27
27
 
28
- const StyledTabbedForm = styled(RaTabbedForm, {
29
- name: 'RaApplicaTabbedForm',
30
- slot: 'Root'
31
- })(({ theme, modal }: { theme: any; modal: boolean }) => ({
28
+ const StyledTabbedForm = styled(RaTabbedForm, { slot: 'Root' })(({ theme, modal }: { theme: any; modal: boolean }) => ({
32
29
  '& .MuiGrid-root.MuiGrid-container': {
33
30
  paddingBottom: theme.spacing(modal ? 0 : 1)
34
31
  } as any,
@@ -38,9 +38,6 @@ import get from 'lodash/get';
38
38
  * </ArrayInput>
39
39
  * </Grid>
40
40
  * </Grid>
41
- *
42
- * @param props
43
- * @returns
44
41
  */
45
42
  export function RawTableFormIterator(props: TableFormIteratorProps): ReactElement | null {
46
43
  const {
@@ -277,10 +274,7 @@ function AddTableRow(props: any): JSX.Element {
277
274
  );
278
275
  }
279
276
 
280
- export const TableFormIterator = styled(RawTableFormIterator, {
281
- name: 'RaApplicaTableFormIterator',
282
- slot: 'Root'
283
- })(({ theme }) => ({
277
+ export const TableFormIterator = styled(RawTableFormIterator, { slot: 'Root' })(({ theme }) => ({
284
278
  '& > div.MuiPaper-root': {
285
279
  overflowX: 'auto',
286
280
  [theme.breakpoints.down('sm')]: {
@@ -1,10 +1,7 @@
1
1
  import { styled } from '@mui/system';
2
2
  import { Toolbar as RaToolbar, ToolbarProps } from 'react-admin';
3
3
 
4
- const StyledToolbar = styled(RaToolbar, {
5
- name: 'RaApplicaToolbar',
6
- slot: 'Root'
7
- })(({ theme }: { theme: any }) => ({
4
+ const StyledToolbar = styled(RaToolbar, { slot: 'Root' })(({ theme }: { theme: any }) => ({
8
5
  ...theme.mixins.toolbar,
9
6
  backgroundColor: theme.palette.background.paper,
10
7
  justifyContent: 'flex-end',
@@ -10,3 +10,4 @@ export * from './SimpleFormIterator';
10
10
  export * from './TabbedForm';
11
11
  export * from './TableForm';
12
12
  export * from './Toolbar';
13
+ export { default as LongForm } from './LongForm';
@@ -2,10 +2,7 @@ import { ArrayInput as RaArrayInput, ArrayInputProps as RaArrayInputProps } from
2
2
  import { styled } from '@mui/material/styles';
3
3
  import LabeledArrayInput, { LabeledArrayInputProps } from './LabeledArrayInput';
4
4
 
5
- const StyledArrayInput = styled(RaArrayInput, {
6
- name: 'ApplicaArrayInput',
7
- slot: 'root'
8
- })(({ theme }) => ({
5
+ const StyledArrayInput = styled(RaArrayInput, { slot: 'root' })(({ theme }) => ({
9
6
  '& .MuiStack-root > label': {
10
7
  marginTop: theme.spacing(2)
11
8
  },
@@ -27,11 +24,8 @@ export type ArrayInputProps = RaArrayInputProps &
27
24
  };
28
25
 
29
26
  /**
30
- * Espone un componente di tipo ArrayInput con stile grafico di Applica.
31
- * Se vuoi utilizzare il componente puro di react-admin puoi usare RaArrayInput esposto nella libreria.
32
- *
33
- * @param {ArrayInputProps}
34
- * @returns {React.ReactElement}
27
+ * Expose an ArrayInput component with Applica graphic style.
28
+ * If you want to use the pure react-admin component you can use RaArrayInput exposed in the library.
35
29
  */
36
30
  export function ArrayInput({ label, addLabel, source, helperText, divider = true, ...props }: ArrayInputProps): React.ReactElement {
37
31
  return (
@@ -20,10 +20,7 @@ const removeDeleteIfNecessary = (disabled: boolean) => {
20
20
  return {};
21
21
  };
22
22
 
23
- const StyledFileInput = styled(RaFileInput, {
24
- name: 'RaApplicaFileInput',
25
- slot: 'root'
26
- })(({ disabled, theme }: { disabled: boolean; theme: any }) => ({
23
+ const StyledFileInput = styled(RaFileInput, { slot: 'root' })(({ disabled, theme }: { disabled: boolean; theme: any }) => ({
27
24
  '& .previews': {},
28
25
  '& .previews>div': {
29
26
  marginTop: theme.spacing(1),
@@ -57,9 +54,6 @@ export type AttachmentInputProps = FileInputProps & {
57
54
  *
58
55
  * @example
59
56
  * <AttachmentInput source="attachments" title="name" accept="image/*" multiple>
60
- *
61
- * @param {AttachmentInputProps}
62
- * @returns
63
57
  */
64
58
  export function AttachmentInput({
65
59
  // @ts-ignore
@@ -3,10 +3,7 @@ import { styled } from '@mui/material/styles';
3
3
  import { useTheme } from '@emotion/react';
4
4
  import LabeledInput from './LabeledInput';
5
5
 
6
- const StyledBooleanInput = styled(RaBooleanInput, {
7
- name: 'RaApplicaBooleanInput',
8
- slot: 'Root'
9
- })(() => ({
6
+ const StyledBooleanInput = styled(RaBooleanInput, { slot: 'Root' })(() => ({
10
7
  marginTop: '0 !important'
11
8
  }));
12
9
 
@@ -2,10 +2,7 @@ import { DateInputProps, DateInput as RaDateInput } from 'react-admin';
2
2
  import { styled } from '@mui/material/styles';
3
3
  import LabeledInput from './LabeledInput';
4
4
 
5
- const StyledDateInput = styled(RaDateInput, {
6
- name: 'RaApplicaDateInput',
7
- slot: 'root'
8
- })(({ label }) => ({
5
+ const StyledDateInput = styled(RaDateInput, { slot: 'root' })(({ label }) => ({
9
6
  '& legend': {
10
7
  width: label === false ? 0 : 'auto'
11
8
  }
@@ -2,10 +2,7 @@ import { DateTimeInputProps, DateTimeInput as RaDateTimeInput } from 'react-admi
2
2
  import { styled } from '@mui/material/styles';
3
3
  import LabeledInput from './LabeledInput';
4
4
 
5
- const StyledDateInput = styled(RaDateTimeInput, {
6
- name: 'RaApplicaDateTimeInput',
7
- slot: 'root'
8
- })(({ label }) => ({
5
+ const StyledDateInput = styled(RaDateTimeInput, { slot: 'root' })(({ label }) => ({
9
6
  '& legend': {
10
7
  width: label === false ? 0 : 'auto'
11
8
  }