@applica-software-guru/react-admin 1.3.167 → 1.3.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.3.167",
3
+ "version": "1.3.169",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -5,6 +5,7 @@ import { Loading } from 'ra-ui-materialui';
5
5
  import { ErrorInfo, Suspense, useState } from 'react';
6
6
  import { ErrorBoundary } from 'react-error-boundary';
7
7
  import Error, { ErrorProps } from './Error';
8
+ import { useTheme } from '@mui/material/styles';
8
9
 
9
10
  type ILayoutContentProps = React.PropsWithChildren & {
10
11
  error?: React.ComponentType<ErrorProps>;
@@ -19,6 +20,7 @@ function LayoutContent(props: ILayoutContentProps) {
19
20
  const handleError = (error: Error, info: ErrorInfo) => {
20
21
  setErrorInfo(info);
21
22
  };
23
+ const theme = useTheme();
22
24
 
23
25
  return (
24
26
  <ErrorBoundary
@@ -37,7 +39,10 @@ function LayoutContent(props: ILayoutContentProps) {
37
39
  position: 'relative',
38
40
  minHeight: 'calc(100vh - 110px)',
39
41
  display: 'flex',
40
- flexDirection: 'column'
42
+ flexDirection: 'column',
43
+ [theme.breakpoints.down('sm')]: {
44
+ px: '12px',
45
+ }
41
46
  }}
42
47
  >
43
48
  {props.children}
@@ -19,6 +19,7 @@ const ResponsiveSection = (props: IResponsiveSectionProps) => {
19
19
  <>
20
20
  {/*@ts-ignore*/}
21
21
  <HeaderToggleButton
22
+ value="drawer"
22
23
  aria-label="open more menu"
23
24
  aria-controls={open ? 'menu-list-grow' : undefined}
24
25
  aria-haspopup="true"
@@ -79,9 +79,17 @@ const StyledCreate = styled(Create, {
79
79
  backgroundColor: theme.palette.background.default
80
80
  },
81
81
  '& .RaCreate-main>.MuiPaper-root:first-of-type': {
82
- overflow: 'visible',
83
82
  backgroundColor: theme.palette.background.default
84
- }
83
+ },
84
+ // Ci ho messo 4 ore per scrivere questa riga di codice e risolvere un problema con react-sticky-box ed i Long Form.
85
+ // L'overflow è di default 'hidden', a noi serve visibile per consentire a react-sticky-box di funzionare e gestire la visiblità con ancore
86
+ // di tutti gli elementi presenti all'interno della pagina.
87
+ '& .RaCreate-main:has(.ApplicaLongFormView)>.MuiPaper-root:first-of-type': {
88
+ overflow: 'visible'
89
+ },
90
+ '& .RaCreate-main:has(.tabbed-form) .MuiTableContainer-root': {
91
+ width: 'inherit',
92
+ },
85
93
  }));
86
94
 
87
95
  export default StyledCreate;
@@ -21,11 +21,16 @@ const StyledEdit = styled(RaEdit, {
21
21
  borderTop: `1px solid ${theme.palette.divider}`
22
22
  },
23
23
  '& .RaEdit-main>.MuiPaper-root:first-of-type': {
24
- // Ci ho messo 4 ore per scrivere questa riga di codice e risolvere un problema con react-sticky-box ed i Long Form.
25
- // L'overflow è di default 'hidden', a noi serve visibile per consentire a react-sticky-box di funzionare e gestire la visiblità con ancore
26
- // di tutti gli elementi presenti all'interno della pagina.
27
- overflow: 'visible',
28
24
  backgroundColor: theme.palette.background.default
25
+ },
26
+ // Ci ho messo 4 ore per scrivere questa riga di codice e risolvere un problema con react-sticky-box ed i Long Form.
27
+ // L'overflow è di default 'hidden', a noi serve visibile per consentire a react-sticky-box di funzionare e gestire la visiblità con ancore
28
+ // di tutti gli elementi presenti all'interno della pagina.
29
+ '& .RaEdit-main:has(.ApplicaLongFormView)>.MuiPaper-root:first-of-type': {
30
+ overflow: 'visible'
31
+ },
32
+ '& .RaEdit-main:has(.tabbed-form) .MuiTableContainer-root': {
33
+ width: 'inherit'
29
34
  }
30
35
  }));
31
36
 
@@ -42,7 +42,7 @@ function BaseForm(props: IBaseFormProps) {
42
42
  formProps = _.omit(props, ['spacing']);
43
43
 
44
44
  return (
45
- <Form {...formProps}>
45
+ <Form {...formProps} className='ApplicaLongFormView'>
46
46
  <StyledGrid container spacing={spacing * 2}>
47
47
  {props.children}
48
48
  </StyledGrid>
@@ -17,7 +17,7 @@ import {
17
17
  } from '@mui/material';
18
18
  import { FormDataConsumer, RaRecord, useRecordContext, useTranslate, useTranslateLabel } from 'ra-core';
19
19
  import { styled, useTheme } from '@mui/material/styles';
20
-
20
+ import ActionsMenu from '../../ActionsMenu';
21
21
  import { PlusCircleOutlined } from '@ant-design/icons';
22
22
  import PropTypes from 'prop-types';
23
23
  import { TableFormIteratorContext } from '../../../contexts';
@@ -52,6 +52,7 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
52
52
  disableActions = false,
53
53
  disableAdd = false,
54
54
  disableRemove = false,
55
+ enableClearAll = false,
55
56
  className,
56
57
  empty,
57
58
  template = {}
@@ -143,6 +144,7 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
143
144
 
144
145
  // @ts-ignore
145
146
  const tableBorderColor = theme.palette.mode === 'dark' ? theme.palette.grey.A400 : theme.palette.grey.A800;
147
+ const showClearAllButton = fields.length > 0 && enableClearAll;
146
148
 
147
149
  return fields ? (
148
150
  // @ts-ignore
@@ -175,9 +177,17 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
175
177
  })}
176
178
 
177
179
  {!disableActions && (
178
- <TableCell sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', verticalAlign: 'top' }} key={'actions'}>
179
- <Typography display={'flex'} variant="subtitle1" fontWeight={500} color="text.primary" textTransform="none" />
180
- </TableCell>
180
+ showClearAllButton ? (
181
+ <TableCell key='actions' sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
182
+ <ActionsMenu horizontal>
183
+ <Typography color="error" onClick={() => setConfirmIsOpen(true)}>
184
+ {translate('ra.action.delete')}
185
+ </Typography>
186
+ </ActionsMenu>
187
+ </TableCell>
188
+ ) : (
189
+ <TableCell key='empty_actions' />
190
+ )
181
191
  )}
182
192
  </TableRow>
183
193
  </TableHead>
@@ -290,6 +300,7 @@ TableFormIterator.propTypes = {
290
300
  resource: PropTypes.string,
291
301
  translate: PropTypes.func,
292
302
  disableAdd: PropTypes.bool,
303
+ enableClearAll: PropTypes.bool,
293
304
  disableRemove: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
294
305
  TransitionProps: PropTypes.shape({}),
295
306
  empty: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
@@ -303,6 +314,7 @@ export interface TableFormIteratorProps extends Partial<UseFieldArrayReturn> {
303
314
  disableAdd?: boolean;
304
315
  disableActions?: boolean;
305
316
  disableRemove?: boolean;
317
+ enableClearAll?: boolean;
306
318
  template?: object;
307
319
  meta?: {
308
320
  // the type defined in FieldArrayRenderProps says error is boolean, which is wrong.
@@ -7,7 +7,9 @@ import { BooleanInput as RaBooleanInput } from 'react-admin';
7
7
  const ApplicaStyledBooleanInput = styled(RaBooleanInput, {
8
8
  name: 'RaApplicaBooleanInput',
9
9
  slot: 'Root'
10
- })(() => ({}));
10
+ })(() => ({
11
+ marginTop: '0 !important'
12
+ }));
11
13
 
12
14
  const BooleanInput = ({ horizontal, ...props }) => {
13
15
  // eslint-disable-next-line no-unused-vars