@applica-software-guru/react-admin 1.3.175 → 1.3.177

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 (98) hide show
  1. package/dist/ApplicaAdmin.d.ts +0 -1
  2. package/dist/ApplicaAdmin.d.ts.map +1 -1
  3. package/dist/components/@extended/Breadcrumbs.d.ts +0 -28
  4. package/dist/components/@extended/Breadcrumbs.d.ts.map +1 -1
  5. package/dist/components/Layout/Navigation/NavCollapse.d.ts +10 -21
  6. package/dist/components/Layout/Navigation/NavCollapse.d.ts.map +1 -1
  7. package/dist/components/Layout/Navigation/NavGroup.d.ts +24 -22
  8. package/dist/components/Layout/Navigation/NavGroup.d.ts.map +1 -1
  9. package/dist/components/Layout/Navigation/NavItem.d.ts +5 -11
  10. package/dist/components/Layout/Navigation/NavItem.d.ts.map +1 -1
  11. package/dist/components/Layout/Navigation/NavList.d.ts +9 -0
  12. package/dist/components/Layout/Navigation/NavList.d.ts.map +1 -0
  13. package/dist/components/Layout/Navigation/Navigation.d.ts.map +1 -1
  14. package/dist/components/Layout/Navigation/index.d.ts +4 -0
  15. package/dist/components/Layout/Navigation/index.d.ts.map +1 -1
  16. package/dist/components/MainCard.d.ts.map +1 -1
  17. package/dist/components/Notification.d.ts +2 -2
  18. package/dist/components/ra-fields/ReadonlyField.d.ts.map +1 -1
  19. package/dist/components/ra-fields/ReferenceManyField.d.ts +1 -36
  20. package/dist/components/ra-fields/ReferenceManyField.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.map +1 -1
  23. package/dist/components/ra-forms/LongForm/BaseForm.d.ts.map +1 -1
  24. package/dist/components/ra-forms/SimpleForm.d.ts.map +1 -1
  25. package/dist/components/ra-forms/TabbedForm.d.ts +12 -3
  26. package/dist/components/ra-forms/TabbedForm.d.ts.map +1 -1
  27. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts +2 -1
  28. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts.map +1 -1
  29. package/dist/components/ra-forms/TableForm/TableFormIteratorItem.d.ts.map +1 -1
  30. package/dist/components/ra-inputs/BooleanInput.d.ts +1 -2
  31. package/dist/components/ra-inputs/BooleanInput.d.ts.map +1 -1
  32. package/dist/components/ra-inputs/LabeledInput.d.ts +0 -5
  33. package/dist/components/ra-inputs/LabeledInput.d.ts.map +1 -1
  34. package/dist/components/ra-inputs/ReferenceManyInput.d.ts +2 -27
  35. package/dist/components/ra-inputs/ReferenceManyInput.d.ts.map +1 -1
  36. package/dist/components/ra-inputs/SelectInput.d.ts +1 -24
  37. package/dist/components/ra-inputs/SelectInput.d.ts.map +1 -1
  38. package/dist/components/ra-lists/Datagrid/index.d.ts.map +1 -1
  39. package/dist/components/ra-lists/List.d.ts.map +1 -1
  40. package/dist/components/ra-lists/NotificationList/NotificationList.d.ts.map +1 -1
  41. package/dist/components/ra-lists/SimpleList.d.ts +15 -0
  42. package/dist/components/ra-lists/SimpleList.d.ts.map +1 -0
  43. package/dist/components/ra-lists/index.d.ts +4 -3
  44. package/dist/components/ra-lists/index.d.ts.map +1 -1
  45. package/dist/contexts/MenuConfigContext.d.ts +2 -26
  46. package/dist/contexts/MenuConfigContext.d.ts.map +1 -1
  47. package/dist/contexts/ThemeConfigContext.d.ts +10 -0
  48. package/dist/contexts/ThemeConfigContext.d.ts.map +1 -1
  49. package/dist/contexts/index.d.ts +0 -2
  50. package/dist/contexts/index.d.ts.map +1 -1
  51. package/dist/hooks/useMenuConfig.d.ts +1 -9
  52. package/dist/hooks/useMenuConfig.d.ts.map +1 -1
  53. package/dist/index.d.ts +1 -1
  54. package/dist/react-admin.cjs.js +59 -59
  55. package/dist/react-admin.cjs.js.map +1 -1
  56. package/dist/react-admin.es.js +7315 -7299
  57. package/dist/react-admin.es.js.map +1 -1
  58. package/dist/react-admin.umd.js +64 -64
  59. package/dist/react-admin.umd.js.map +1 -1
  60. package/package.json +1 -1
  61. package/src/ApplicaAdmin.tsx +1 -24
  62. package/src/components/@extended/Breadcrumbs.jsx +0 -20
  63. package/src/components/Layout/Navigation/{NavCollapse.jsx → NavCollapse.tsx} +25 -20
  64. package/src/components/Layout/Navigation/{NavGroup.jsx → NavGroup.tsx} +35 -11
  65. package/src/components/Layout/Navigation/{NavItem.jsx → NavItem.tsx} +12 -9
  66. package/src/components/Layout/Navigation/NavList.tsx +23 -0
  67. package/src/components/Layout/Navigation/Navigation.tsx +7 -13
  68. package/src/components/Layout/Navigation/index.ts +4 -0
  69. package/src/components/MainCard.tsx +1 -7
  70. package/src/components/ra-fields/ReadonlyField.tsx +6 -1
  71. package/src/components/ra-fields/ReferenceManyField.tsx +40 -58
  72. package/src/components/ra-forms/Create.tsx +5 -2
  73. package/src/components/ra-forms/Edit.jsx +3 -0
  74. package/src/components/ra-forms/FormHeader.tsx +2 -2
  75. package/src/components/ra-forms/LongForm/BaseForm.tsx +9 -5
  76. package/src/components/ra-forms/SimpleForm.tsx +4 -3
  77. package/src/components/ra-forms/TabbedForm.tsx +51 -12
  78. package/src/components/ra-forms/TableForm/TableFormIterator.tsx +31 -15
  79. package/src/components/ra-forms/TableForm/TableFormIteratorItem.tsx +10 -9
  80. package/src/components/ra-inputs/AutocompleteArrayInput.jsx +3 -3
  81. package/src/components/ra-inputs/AutocompleteInput.jsx +3 -3
  82. package/src/components/ra-inputs/BooleanInput.jsx +16 -29
  83. package/src/components/ra-inputs/LabeledInput.tsx +1 -6
  84. package/src/components/ra-inputs/SelectArrayInput.jsx +3 -3
  85. package/src/components/ra-inputs/SelectInput.tsx +4 -9
  86. package/src/components/ra-lists/Datagrid/index.tsx +8 -2
  87. package/src/components/ra-lists/List.tsx +26 -12
  88. package/src/components/ra-lists/NotificationList/NotificationList.jsx +7 -10
  89. package/src/components/ra-lists/SimpleList.tsx +13 -0
  90. package/src/components/ra-lists/index.ts +4 -3
  91. package/src/contexts/MenuConfigContext.tsx +15 -12
  92. package/src/contexts/ThemeConfigContext.tsx +28 -2
  93. package/src/contexts/index.jsx +0 -2
  94. package/src/index.jsx +8 -8
  95. package/dist/contexts/MenuPropTypes.d.ts +0 -13
  96. package/dist/contexts/MenuPropTypes.d.ts.map +0 -1
  97. package/src/contexts/MenuPropTypes.jsx +0 -20
  98. /package/src/hooks/{useMenuConfig.jsx → useMenuConfig.ts} +0 -0
@@ -12,13 +12,17 @@ const StyledGrid = styled(Grid, {
12
12
  name: 'ApplicaLongFormView',
13
13
  slot: 'Root'
14
14
  })(({ theme }) => ({
15
- '& .MuiToolbar-root': {
15
+ // This style must be applied only to root toolbars used to save data in the form.
16
+ // Other toolbars must be handled outside this rule.
17
+ '& .MuiToolbar-root.RaToolbar-desktopToolbar': {
16
18
  position: 'initial',
17
- marginTop: theme.spacing(2),
19
+ marginTop: theme.spacing(2.5),
18
20
  marginLeft: `-${theme.spacing(3)}`,
19
21
  marginRight: `-${theme.spacing(3)}`,
20
22
  marginBottom: `-${theme.spacing(2)}`,
21
23
  borderTop: `1px solid ${theme.palette.divider}`,
24
+ paddingTop: theme.spacing(2.5),
25
+ paddingBottom: theme.spacing(2.5),
22
26
  [theme.breakpoints.down('sm')]: {
23
27
  position: 'initial !important',
24
28
  width: 'auto !important',
@@ -26,8 +30,8 @@ const StyledGrid = styled(Grid, {
26
30
  }
27
31
  },
28
32
  '& form > .MuiToolbar-root': {
29
- // È molto importante: questa regola serve per poter inserire form, all'interno di altri form, evitando
30
- // che la toolbar del form interno recepisca gli stili della regola precedente (che genera un padding strano).
33
+ // This is really important: this rule is used to insert forms inside other forms, avoiding
34
+ // the toolbar of the inner form to receive the styles of the previous rule (which generates a strange padding).
31
35
  margin: 0,
32
36
  marginRight: `-${theme.spacing(0.5)}`,
33
37
  [theme.breakpoints.down('sm')]: {
@@ -42,7 +46,7 @@ function BaseForm(props: IBaseFormProps) {
42
46
  formProps = _.omit(props, ['spacing']);
43
47
 
44
48
  return (
45
- <Form {...formProps} className='ApplicaLongFormView'>
49
+ <Form {...formProps} className="ApplicaLongFormView">
46
50
  <StyledGrid container spacing={spacing * 2}>
47
51
  {props.children}
48
52
  </StyledGrid>
@@ -18,7 +18,7 @@ const ApplicaStyledSimpleForm = styled(RaSimpleForm, {
18
18
  slot: 'Root'
19
19
  })(({ theme, modal }: { theme: any; modal: boolean }) => ({
20
20
  '& .MuiGrid-root.MuiGrid-container': {
21
- paddingBottom: theme.spacing(modal ? 0 : 1)
21
+ paddingBottom: theme.spacing(modal ? 0 : 2.5)
22
22
  } as any,
23
23
  [theme.breakpoints.down('sm')]: {
24
24
  paddingBottom: 0
@@ -50,8 +50,9 @@ const SimpleForm = ({ title, modal, content, subheader, secondary, sx, ...props
50
50
  sx={{
51
51
  ...sx,
52
52
  '& .MuiToolbar-root': {
53
- paddingLeft: '20px !important',
54
- paddingRight: '20px !important'
53
+ paddingLeft: 2.5,
54
+ paddingRight: 2.5,
55
+ paddingBottom: 2.5
55
56
  }
56
57
  }}
57
58
  border={!modal}
@@ -1,9 +1,16 @@
1
- import { TabbedForm as RaTabbedForm, TabbedFormProps as RaTabbedFormProps, DeleteWithConfirmButton, SaveButton } from 'react-admin';
1
+ import {
2
+ TabbedForm as RaTabbedForm,
3
+ TabbedFormProps as RaTabbedFormProps,
4
+ DeleteWithConfirmButton,
5
+ SaveButton,
6
+ TabProps
7
+ } from 'react-admin';
2
8
  import MainCard from '../MainCard';
3
9
  import { useResourceTitle } from '../../hooks';
4
10
  import Toolbar from './Toolbar';
5
11
  import { styled } from '@mui/system';
6
12
  import ActionsMenu from '../ActionsMenu';
13
+ import { Box } from '@mui/material';
7
14
 
8
15
  export type TabbedFormProps = RaTabbedFormProps & {
9
16
  modal?: boolean;
@@ -11,6 +18,11 @@ export type TabbedFormProps = RaTabbedFormProps & {
11
18
  subheader?: string | React.ReactNode;
12
19
  title?: string | React.ReactNode | boolean;
13
20
  secondary?: string | React.ReactNode;
21
+ /**
22
+ * Indicates if the form should have no padding.
23
+ * If true, the form will have no padding and you will be **responsible** for adding padding to the form's tabs.
24
+ */
25
+ noPadding?: boolean;
14
26
  };
15
27
 
16
28
  const StyledTabbedForm = styled(RaTabbedForm, {
@@ -21,38 +33,64 @@ const StyledTabbedForm = styled(RaTabbedForm, {
21
33
  paddingBottom: theme.spacing(modal ? 0 : 1)
22
34
  } as any,
23
35
  [theme.breakpoints.down('sm')]: {
24
- paddingBottom: 0
36
+ paddingBottom: 0,
37
+ '& .MuiTableContainer-root': {
38
+ paddingBottom: theme.spacing(1)
39
+ }
25
40
  }
26
41
  }));
27
42
 
28
- const ApplicaTabbedForm = (props: TabbedFormProps) => {
29
- const { title, modal, content, subheader, secondary, sx, ...rest } = props;
30
- const cardTitle = useResourceTitle(title);
43
+ const TabbedFormWithNoPadding = ({ children }: { children: React.ReactNode }) => <>{children}</>;
44
+
45
+ const TabbedForm = (props: TabbedFormProps) => {
46
+ const { title: _title, modal, content, subheader, secondary, sx, noPadding, ...rest } = props;
47
+ const title = useResourceTitle(_title);
31
48
 
32
49
  return (
33
50
  <MainCard
34
- title={cardTitle}
51
+ title={title}
35
52
  modal={modal}
36
53
  content={content}
37
54
  subheader={subheader}
38
55
  secondary={secondary}
39
56
  sx={{
40
57
  ...sx,
58
+ '& .MuiTabs-root': {
59
+ m: 2.5,
60
+ mb: 0
61
+ },
62
+ '& .tabbed-form .MuiDivider-root': {
63
+ ml: 2.5,
64
+ mr: 2.5
65
+ },
66
+
41
67
  '& .MuiToolbar-root': {
42
- paddingLeft: '20px !important',
43
- paddingRight: '20px !important'
68
+ padding: 2.5
44
69
  }
45
70
  }}
46
71
  border={!modal}
47
72
  divider
48
73
  >
49
74
  {/** @ts-ignore */}
50
- <StyledTabbedForm toolbar={<Toolbar />} {...rest} />
75
+ <StyledTabbedForm toolbar={<Toolbar />} component={noPadding ? TabbedFormWithNoPadding : undefined} {...rest} />
51
76
  </MainCard>
52
77
  );
53
78
  };
79
+ export type StackTabProps = TabProps & {
80
+ children: React.ReactNode;
81
+ };
82
+
83
+ /**
84
+ * Useful when you have tabbed form with noPadding and you want to add padding to the tabs.
85
+ * This component render inside a TabbedForm with noPadding and add padding to the tabs.
86
+ */
87
+ const TabStack = ({ children, ...props }: StackTabProps): JSX.Element => (
88
+ <RaTabbedForm.Tab {...props}>
89
+ <Box sx={{ width: '100%', p: 2.5 }}>{children}</Box>
90
+ </RaTabbedForm.Tab>
91
+ );
54
92
 
55
- ApplicaTabbedForm.defaultProps = {
93
+ TabbedForm.defaultProps = {
56
94
  toolbar: (
57
95
  <Toolbar>
58
96
  <SaveButton type="button" />
@@ -65,6 +103,7 @@ ApplicaTabbedForm.defaultProps = {
65
103
  )
66
104
  };
67
105
 
68
- ApplicaTabbedForm.Tab = RaTabbedForm.Tab;
106
+ TabbedForm.Tab = RaTabbedForm.Tab;
107
+ TabbedForm.TabStack = TabStack;
69
108
 
70
- export default ApplicaTabbedForm;
109
+ export default TabbedForm;
@@ -55,7 +55,8 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
55
55
  enableClearAll = false,
56
56
  className,
57
57
  empty,
58
- template = {}
58
+ template = {},
59
+ inset
59
60
  } = props;
60
61
  const [confirmIsOpen, setConfirmIsOpen] = useState<boolean>(false);
61
62
  const { fields, remove, replace, append } = useArrayInput(props);
@@ -155,12 +156,22 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
155
156
  source,
156
157
  disableAdd,
157
158
  template,
158
- onClick: handleAddButtonClick((props?.addButton as any)?.props?.onClick)
159
+ onClick: handleAddButtonClick((props?.addButton as any)?.props?.onClick),
160
+ inset
159
161
  })}
160
162
 
161
- <TableContainer component={Paper} sx={{ mt: 2, border: `1px solid ${tableBorderColor}` }}>
162
- <Table>
163
- <TableHead sx={{ borderTop: 0, borderBottom: `1px solid ${tableBorderColor}` }}>
163
+ <TableContainer
164
+ component={Paper}
165
+ sx={
166
+ inset === true
167
+ ? {
168
+ borderRadius: 0
169
+ }
170
+ : { mt: 2, border: `1px solid ${tableBorderColor}` }
171
+ }
172
+ >
173
+ <Table size="small">
174
+ <TableHead sx={inset === true ? {} : { borderTop: 0, borderBottom: `1px solid ${tableBorderColor}` }}>
164
175
  <TableRow>
165
176
  {/** @ts-ignore */}
166
177
  {Children.map(children, (input: ReactElement, index) => {
@@ -169,16 +180,16 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
169
180
  }
170
181
  return (
171
182
  <TableCell key={index}>
172
- <Typography display={'flex'} variant="subtitle1" fontWeight={500} color="text.primary" textTransform="none">
183
+ <Typography display={'flex'} variant="subtitle1" color="text.primary" textTransform="none">
173
184
  {translateLabel({ ...input.props, resource })}
174
185
  </Typography>
175
186
  </TableCell>
176
187
  );
177
188
  })}
178
189
 
179
- {!disableActions && (
180
- showClearAllButton ? (
181
- <TableCell key='actions' sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
190
+ {!disableActions &&
191
+ (showClearAllButton ? (
192
+ <TableCell key="actions" sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
182
193
  <ActionsMenu horizontal>
183
194
  <Typography color="error" onClick={() => setConfirmIsOpen(true)}>
184
195
  {translate('ra.action.delete')}
@@ -186,9 +197,8 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
186
197
  </ActionsMenu>
187
198
  </TableCell>
188
199
  ) : (
189
- <TableCell key='empty_actions' />
190
- )
191
- )}
200
+ <TableCell key="empty_actions" />
201
+ ))}
192
202
  </TableRow>
193
203
  </TableHead>
194
204
 
@@ -245,14 +255,14 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
245
255
  };
246
256
 
247
257
  const AddTableRow = (props: any) => {
248
- const { label, disableAdd, onClick } = props;
258
+ const { label, disableAdd, onClick, inset } = props;
249
259
  const theme = useTheme();
250
260
  // @ts-ignore
251
261
  const tableBorderColor = theme.palette.mode === 'dark' ? theme.palette.grey.A400 : theme.palette.grey.A800;
252
262
  const iconColor = theme.palette.mode === 'light' ? '#000000' : '#FFFFFF';
253
263
 
254
264
  return (
255
- <Stack justifyContent={'space-between'} alignItems={'center'} flexDirection={'row'} sx={{ mt: 0.5 }}>
265
+ <Stack justifyContent={'space-between'} alignItems={'center'} flexDirection={'row'} sx={inset ? { p: 2.5 } : { pt: 2 }}>
256
266
  {label !== false && <Typography>{label}</Typography>}
257
267
  {!disableAdd &&
258
268
  (React.isValidElement(props?.addButton) ? (
@@ -260,7 +270,7 @@ const AddTableRow = (props: any) => {
260
270
  onClick: onClick
261
271
  })
262
272
  ) : (
263
- <IconButton size="small" color="secondary" sx={{ border: `1px solid ${tableBorderColor}` }} onClick={onClick}>
273
+ <IconButton color="secondary" sx={{ border: `1px solid ${tableBorderColor}` }} onClick={onClick}>
264
274
  <PlusCircleOutlined style={{ color: iconColor }} />
265
275
  </IconButton>
266
276
  ))}
@@ -277,6 +287,11 @@ const StyledTableFormIterator = styled(TableFormIterator, {
277
287
  [theme.breakpoints.down('sm')]: {
278
288
  width: `calc(100vw - ${theme.spacing(8)})`
279
289
  }
290
+ },
291
+ [theme.breakpoints.down('sm')]: {
292
+ '& .MuiTableRow-root:last-child': {
293
+ borderBottom: 0
294
+ }
280
295
  }
281
296
  }));
282
297
 
@@ -327,6 +342,7 @@ export interface TableFormIteratorProps extends Partial<UseFieldArrayReturn> {
327
342
  source?: string;
328
343
  sx?: SxProps;
329
344
  empty: ReactNode | string;
345
+ inset?: boolean;
330
346
  }
331
347
 
332
348
  export default StyledTableFormIterator;
@@ -2,13 +2,12 @@ import * as React from 'react';
2
2
 
3
3
  import { Children, ReactElement, ReactNode, cloneElement, isValidElement, useMemo } from 'react';
4
4
  import { Confirm, useTranslate } from 'react-admin';
5
- import { TableCell, Typography } from '@mui/material';
5
+ import { Stack, TableCell, Typography } from '@mui/material';
6
6
  import { TableFormIteratorItemContext, TableFormIteratorItemContextValue } from '../../../contexts';
7
7
  import ActionsMenu from '../../ActionsMenu';
8
8
  import { RaRecord } from 'ra-core';
9
9
  import { useTableFormIterator } from '../../../hooks';
10
10
 
11
-
12
11
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
12
  export const TableFormIteratorItem = React.forwardRef((props: TableFormIteratorItemProps, ref: any) => {
14
13
  const { children, disabled, disableActions = false, index, member, resource } = props;
@@ -40,7 +39,7 @@ export const TableFormIteratorItem = React.forwardRef((props: TableFormIteratorI
40
39
  }
41
40
  const { source, ...inputProps } = input.props;
42
41
  return (
43
- <TableCell sx={{ border: 0, verticalAlign: 'top' }}>
42
+ <TableCell>
44
43
  {cloneElement(input, {
45
44
  source: source ? `${member}.${source}` : member,
46
45
  index: source ? undefined : index2,
@@ -54,12 +53,14 @@ export const TableFormIteratorItem = React.forwardRef((props: TableFormIteratorI
54
53
  })}
55
54
 
56
55
  {!disableActions && (
57
- <TableCell sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', border: 0, pt: 2.5 }}>
58
- <ActionsMenu horizontal>
59
- <Typography color="error" onClick={() => setConfirmIsOpen(true)}>
60
- {translate('ra.action.delete')}
61
- </Typography>
62
- </ActionsMenu>
56
+ <TableCell>
57
+ <Stack direction="row" spacing={1} justifyContent="center" alignItems="center">
58
+ <ActionsMenu horizontal>
59
+ <Typography color="error" onClick={() => setConfirmIsOpen(true)}>
60
+ {translate('ra.action.delete')}
61
+ </Typography>
62
+ </ActionsMenu>
63
+ </Stack>
63
64
  </TableCell>
64
65
  )}
65
66
  {/** @ts-ignore */}
@@ -11,10 +11,10 @@ const StyledAutocompleteArrayInput = styled(RaAutocompleteArrayInput, {
11
11
  },
12
12
  '& .MuiAutocomplete-inputRoot': {
13
13
  padding: `0px 9px`
14
- },
15
- '& label.MuiFormLabel-root[data-shrink="false"]': {
16
- minHeight: '18px'
17
14
  }
15
+ // '& label.MuiFormLabel-root[data-shrink="false"]': {
16
+ // minHeight: '18px'
17
+ // }
18
18
  }));
19
19
 
20
20
  // eslint-disable-next-line no-unused-vars
@@ -9,9 +9,9 @@ const StyledAutocompleteInput = styled(RaAutocompleteInput, {
9
9
  '& legend': {
10
10
  width: label === false ? 0 : 'auto'
11
11
  },
12
- '& label.MuiFormLabel-root[data-shrink="false"]': {
13
- minHeight: '18px'
14
- },
12
+ // '& label.MuiFormLabel-root[data-shrink="false"]': {
13
+ // minHeight: '18px'
14
+ // },
15
15
  '& .MuiAutocomplete-inputRoot': {
16
16
  // Serve ad allineare l'altezza di un input di tipo Autocomplete a quella degli altri campi utilizzati.
17
17
  padding: `0px 9px`
@@ -1,5 +1,5 @@
1
- import { styled, useTheme } from '@mui/material/styles';
2
-
1
+ import { styled } from '@mui/material/styles';
2
+ import { useTheme } from '@emotion/react';
3
3
  import LabeledInput from './LabeledInput';
4
4
  import PropTypes from 'prop-types';
5
5
  import { BooleanInput as RaBooleanInput } from 'react-admin';
@@ -11,35 +11,22 @@ const ApplicaStyledBooleanInput = styled(RaBooleanInput, {
11
11
  marginTop: '0 !important'
12
12
  }));
13
13
 
14
- const BooleanInput = ({ horizontal, ...props }) => {
15
- // eslint-disable-next-line no-unused-vars
14
+ const BooleanInput = ({ ...props }) => {
16
15
  const theme = useTheme();
17
16
  return (
18
- <LabeledInput
19
- {...props}
20
- sx={
21
- horizontal
22
- ? {
23
- flexDirection: horizontal ? 'row' : 'column',
24
- alignItems: horizontal ? 'center' : 'flex-start',
25
- '& .MuiFormGroup-root': {
26
- margin: 0
27
- },
28
- '& .MuiFormControlLabel-root': {
29
- margin: 0,
30
- '& .MuiTypography-root': {
31
- display: 'none',
32
- visibility: 'hidden'
33
- },
34
- '& .MuiSwitch-root': {
35
- marginRight: `-${theme.spacing(0.5)}`
36
- }
37
- }
38
- }
39
- : {}
40
- }
41
- >
42
- <ApplicaStyledBooleanInput />
17
+ <LabeledInput {...props}>
18
+ <ApplicaStyledBooleanInput
19
+ sx={{
20
+ '& .MuiFormControlLabel-root': {
21
+ marginLeft: '0 !important',
22
+ marginRight: '0 !important'
23
+ },
24
+ '& .MuiSwitch-root': {
25
+ margin: '0 !important',
26
+ marginTop: props.display === 'legend' ? 0 : `${theme.spacing(1)} !important`
27
+ }
28
+ }}
29
+ />
43
30
  </LabeledInput>
44
31
  );
45
32
  };
@@ -4,7 +4,7 @@ import { FormHelperText, InputLabel, Stack } from '@mui/material';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
  import { useAppConfig } from '../../hooks';
7
- import { useTheme } from '@emotion/react';
7
+ import { useTheme } from '@mui/material/styles';
8
8
 
9
9
  export type LabeledInputProps = InputProps & {
10
10
  sx?: any;
@@ -19,11 +19,6 @@ export type LabeledInputProps = InputProps & {
19
19
  divider?: boolean;
20
20
  };
21
21
 
22
- /**
23
- * Consente di disegnare un input con una label e un eventuale messaggio di aiuto.
24
- *
25
- * @returns {JSX.Element}
26
- */
27
22
  const LabeledInput = ({ label, children, display, helperText, sx, addLabel, divider, ...props }: LabeledInputProps): JSX.Element => {
28
23
  const theme = useTheme();
29
24
  const { getCurrentDialog } = useAppConfig();
@@ -12,10 +12,10 @@ const ApplicaStyledSelectArrayInput = styled(RaSelectArrayInput, {
12
12
  '& .RaSelectArrayInput-chips > .RaSelectArrayInput-chip': {
13
13
  marginTop: '-2px',
14
14
  marginBottom: '-2px'
15
- },
16
- '& label.MuiFormLabel-root[data-shrink="false"]': {
17
- marginTop: '2px'
18
15
  }
16
+ // '& label.MuiFormLabel-root[data-shrink="false"]': {
17
+ // marginTop: '2px'
18
+ // }
19
19
  }));
20
20
 
21
21
  ApplicaStyledSelectArrayInput.propTypes = {
@@ -8,11 +8,11 @@ const ApplicaStyledSelectInput = styled(RaSelectInput, {
8
8
  slot: 'Root'
9
9
  })(({ label }) => ({
10
10
  '& legend': {
11
- width: label === false ? 0 : 'auto'
12
- },
13
- '& label.MuiFormLabel-root[data-shrink="false"]': {
14
- marginTop: '2px'
11
+ width: label === false || label === null ? 0 : 'auto'
15
12
  }
13
+ // '& label.MuiFormLabel-root[data-shrink="false"]': {
14
+ // marginTop: '2px'
15
+ // }
16
16
  }));
17
17
  export type SelectInputProps = LabeledInputProps & RaSelectInputProps;
18
18
  const SelectInput = (props: SelectInputProps) => (
@@ -21,9 +21,4 @@ const SelectInput = (props: SelectInputProps) => (
21
21
  </LabeledInput>
22
22
  );
23
23
 
24
- SelectInput.propTypes = {
25
- ...RaSelectInput.propTypes,
26
- ...LabeledInput.propTypes
27
- };
28
-
29
24
  export default SelectInput;
@@ -6,7 +6,10 @@ import { styled } from '@mui/material/styles';
6
6
  const StyledDatagrid = styled(RaDatagrid, {
7
7
  name: 'ApplicaDatagrid',
8
8
  slot: 'root'
9
- })(() => ({
9
+ })(({ theme }) => ({
10
+ '& .RaBulkActionsToolbar-toolbar': {
11
+ height: 48
12
+ },
10
13
  // Resolve an issue related to the visualization of the bulk actions toolbar.
11
14
  // Padding and margin create a non empty space that allows the toolbar to be displayed when
12
15
  // the selection is empty.
@@ -27,7 +30,10 @@ const StyledDatagrid = styled(RaDatagrid, {
27
30
  '& th': {
28
31
  textOverflow: 'ellipsis',
29
32
  overflow: 'hidden',
30
- whiteSpace: 'nowrap'
33
+ whiteSpace: 'nowrap',
34
+ backgroundColor: 'inherit !important',
35
+ textTransform: 'none',
36
+ fontSize: theme.typography.subtitle1.fontSize
31
37
  }
32
38
  }));
33
39
 
@@ -145,20 +145,23 @@ const ApplicaStyledList = styled(RaList, {
145
145
  padding: theme.spacing(2),
146
146
  paddingBottom: theme.spacing(2),
147
147
  alignItems: 'flex-start'
148
- },
149
- '& .MuiButton-root': {
150
- margin: theme.spacing(2)
151
148
  }
152
149
  },
153
-
150
+ '& .MuiButton-root': {
151
+ margin: 0
152
+ },
154
153
  '& .RaList-actions': {
155
- padding: theme.spacing(2),
156
- paddingTop: theme.spacing(1),
154
+ minHeight: 80,
157
155
  alignItems: 'center',
156
+ padding: theme.spacing(2.5),
158
157
  '& form': {
159
- alignItems: 'center'
158
+ alignItems: 'center',
159
+ minHeight: 'auto',
160
+ paddingBottom: 0,
161
+ rowGap: theme.spacing(2.5)
160
162
  },
161
163
  '& .RaFilterForm-filterFormInput': {
164
+ margin: 0,
162
165
  '& .MuiFormControl-root': {
163
166
  marginTop: 0
164
167
  },
@@ -166,17 +169,28 @@ const ApplicaStyledList = styled(RaList, {
166
169
  alignSelf: 'center',
167
170
  marginTop: 0
168
171
  },
169
- marginTop: theme.spacing(1.5)
172
+ // This rule allows each filter input to be 100% width when the screen is small.
173
+ [theme.breakpoints.down('sm')]: {
174
+ '&>.MuiStack-root': {
175
+ width: '100%',
176
+ '&>div': {
177
+ width: '100%'
178
+ }
179
+ }
180
+ }
170
181
  },
171
182
  '& .RaFilterFormInput-hideButton': {
172
- marginBottom: theme.spacing(0.5),
173
- marginRight: theme.spacing(1)
183
+ margin: '0 !important',
184
+ alignSelf: 'center'
174
185
  },
175
186
  '& > .MuiToolbar-root': {
176
187
  flex: 'unset',
177
188
  padding: 0,
178
- alignSelf: 'flex-end',
179
- minHeight: 'fit-content'
189
+ alignSelf: 'center',
190
+ minHeight: 'fit-content',
191
+ [theme.breakpoints.down('sm')]: {
192
+ paddingBottom: theme.spacing(2)
193
+ }
180
194
  }
181
195
  },
182
196
 
@@ -1,5 +1,5 @@
1
1
  import { MarkAsReadedButton, MarkAsUnreadedButton } from './button';
2
- import React, { useCallback, useMemo } from 'react';
2
+ import { useMemo } from 'react';
3
3
  import { darken, lighten, useTheme } from '@mui/material';
4
4
 
5
5
  import ActionsMenu from '../../ActionsMenu';
@@ -17,17 +17,14 @@ const NotificationList = ({ ...props }) => {
17
17
  }),
18
18
  [theme.palette.mode]
19
19
  );
20
- const handleRowStyle = useCallback(
21
- (record) => ({
22
- backgroundColor: record?.readed ? colorize(theme.palette.primary[mode], density) : colorize(theme.palette.secondary[mode], density)
23
- }),
24
- [theme, mode, colorize, density]
25
- );
20
+ const rowSx = (record) => ({
21
+ backgroundColor: !record?.readed ? colorize(theme.palette.primary[mode], density) : colorize(theme.palette.secondary[mode], density)
22
+ });
26
23
 
27
24
  return (
28
- <Datagrid {...props} rowStyle={handleRowStyle}>
29
- <NotificationField source="notification" sortable={false} label="ra.notification" />
30
- <DateAgoField source="created" label="ra.notification.created" />
25
+ <Datagrid {...props} rowSx={rowSx}>
26
+ <NotificationField source="notification" sortable={false} />
27
+ <DateAgoField source="created" />
31
28
  <ActionsMenu>
32
29
  <MarkAsReadedButton />
33
30
  <MarkAsUnreadedButton />
@@ -0,0 +1,13 @@
1
+ import { SimpleList as RaSimpleList } from 'react-admin';
2
+ import { styled } from '@mui/material/styles';
3
+
4
+ const StyledSimpleList = styled(RaSimpleList, {
5
+ name: 'ApplicaSimpleList',
6
+ slot: 'root'
7
+ })(({ theme }) => ({
8
+ padding: theme.spacing(1),
9
+ paddingTop: 0,
10
+ paddingBottom: 0
11
+ }));
12
+
13
+ export default StyledSimpleList;
@@ -1,6 +1,7 @@
1
+ export { default as BulkActionsToolbar } from './BulkActionsToolbar';
2
+ export { default as BulkFloatingActionsToolbar } from './BulkFloatingActionsToolbar';
1
3
  export { default as Datagrid } from './Datagrid';
2
4
  export { default as Empty } from './Empty';
3
- export { default as NotificationList } from './NotificationList';
4
5
  export { default as List } from './List';
5
- export { default as BulkActionsToolbar } from './BulkActionsToolbar';
6
- export { default as BulkFloatingActionsToolbar } from './BulkFloatingActionsToolbar';
6
+ export { default as NotificationList } from './NotificationList';
7
+ export { default as SimpleList } from './SimpleList';