@applica-software-guru/react-admin 1.0.76 → 1.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/@extended/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/ra-inputs/LabeledInput.d.ts +39 -31
- package/dist/components/ra-inputs/LabeledInput.d.ts.map +1 -1
- package/dist/components/ra-lists/List.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +5 -5
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +51 -32
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +40 -40
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/@extended/Breadcrumbs.jsx +4 -2
- package/src/components/ra-inputs/{LabeledInput.jsx → LabeledInput.tsx} +25 -2
- package/src/components/ra-lists/List.tsx +37 -22
package/package.json
CHANGED
|
@@ -18,11 +18,13 @@ const renderBreadcrumb = ({ id, title, icon, url, last }) => {
|
|
|
18
18
|
to={url}
|
|
19
19
|
variant={last ? 'subtitle1' : 'h6'}
|
|
20
20
|
sx={{
|
|
21
|
-
textDecoration: 'none'
|
|
21
|
+
textDecoration: 'none',
|
|
22
|
+
display: 'inline-flex',
|
|
23
|
+
alignItems: 'center'
|
|
22
24
|
}}
|
|
23
25
|
color="textSecondary"
|
|
24
26
|
>
|
|
25
|
-
{icon && <Icon style={{ marginRight: 8 }} />}
|
|
27
|
+
{icon && <Icon style={{ marginRight: 8, fontSize: '0.875rem' }} />}
|
|
26
28
|
{title}
|
|
27
29
|
</Typography>
|
|
28
30
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldTitle, useInput } from 'react-admin';
|
|
1
|
+
import { FieldTitle, InputProps, useInput } from 'react-admin';
|
|
2
2
|
import { FormHelperText, InputLabel, Stack } from '@mui/material';
|
|
3
3
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -6,7 +6,25 @@ import React from 'react';
|
|
|
6
6
|
import { useAppConfig } from '../../hooks';
|
|
7
7
|
import { useTheme } from '@emotion/react';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
export type LabeledInputProps = InputProps & {
|
|
10
|
+
sx?: any;
|
|
11
|
+
children?: React.ReactElement;
|
|
12
|
+
label?: string | boolean;
|
|
13
|
+
addLabel?: boolean;
|
|
14
|
+
resource?: string;
|
|
15
|
+
isRequired?: boolean;
|
|
16
|
+
source?: string;
|
|
17
|
+
display?: 'legend' | 'label';
|
|
18
|
+
helperText?: string | boolean;
|
|
19
|
+
divider?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Consente di disegnare un input con una label e un eventuale messaggio di aiuto.
|
|
24
|
+
*
|
|
25
|
+
* @returns {JSX.Element}
|
|
26
|
+
*/
|
|
27
|
+
const LabeledInput = ({ label, children, display, helperText, sx, addLabel, divider, ...props }: LabeledInputProps): JSX.Element => {
|
|
10
28
|
const theme = useTheme();
|
|
11
29
|
const { getCurrentDialog } = useAppConfig();
|
|
12
30
|
const { source, resource, isRequired } = props;
|
|
@@ -18,10 +36,13 @@ const LabeledInput = ({ label, children, display, helperText, sx, addLabel, divi
|
|
|
18
36
|
<Stack
|
|
19
37
|
spacing={1}
|
|
20
38
|
sx={{
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
width: props?.fullWidth ? '100%' : 'auto',
|
|
21
41
|
'& .MuiFormHelperText-root': {
|
|
22
42
|
// @see: https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx#L340
|
|
23
43
|
// the 'invalid' prop is not used inside the react-admin component. This is necessary if we want to support
|
|
24
44
|
// remove error message colorization when the field is in error state.
|
|
45
|
+
/** @ts-ignore */
|
|
25
46
|
color: invalid ? theme.palette.error.main : theme.palette.text.secondary,
|
|
26
47
|
'& span': {
|
|
27
48
|
display: 'none'
|
|
@@ -34,6 +55,7 @@ const LabeledInput = ({ label, children, display, helperText, sx, addLabel, divi
|
|
|
34
55
|
<InputLabel
|
|
35
56
|
error={invalid === true}
|
|
36
57
|
sx={{
|
|
58
|
+
// @ts-ignore
|
|
37
59
|
borderBottom: divider ? `1px solid ${theme.palette.divider}` : 'none',
|
|
38
60
|
pb: divider ? 1 : 0,
|
|
39
61
|
mt: divider ? 1 : 0
|
|
@@ -44,6 +66,7 @@ const LabeledInput = ({ label, children, display, helperText, sx, addLabel, divi
|
|
|
44
66
|
)}
|
|
45
67
|
{React.isValidElement(children)
|
|
46
68
|
? React.cloneElement(children, {
|
|
69
|
+
// @ts-ignore
|
|
47
70
|
...children.props,
|
|
48
71
|
...props,
|
|
49
72
|
label: display === 'legend' ? label : false
|
|
@@ -32,37 +32,52 @@ const ApplicaStyledList = styled(RaList, {
|
|
|
32
32
|
},
|
|
33
33
|
'& .MuiButton-root': {
|
|
34
34
|
margin: theme.spacing(2)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
'& .RaList-actions': {
|
|
39
|
+
padding: theme.spacing(2),
|
|
40
|
+
paddingTop: 0,
|
|
41
|
+
'& .RaFilterForm-filterFormInput': {
|
|
42
|
+
'& .ra-input': {
|
|
43
|
+
alignSelf: 'center'
|
|
44
|
+
},
|
|
45
|
+
[theme.breakpoints.down('sm')]: {
|
|
46
|
+
// Quando lo schermo è piccolo, il filtro viene visualizzato in una colonna.
|
|
47
|
+
// Diamo un margine maggiore in basso per evitare che siano troppo vicini.
|
|
48
|
+
marginTop: theme.spacing(1),
|
|
49
|
+
marginBottom: theme.spacing(1)
|
|
50
|
+
}
|
|
38
51
|
},
|
|
39
52
|
'& .RaFilterFormInput-hideButton': {
|
|
40
53
|
marginTop: theme.spacing(1),
|
|
41
54
|
marginBottom: theme.spacing(0.5),
|
|
42
55
|
marginRight: theme.spacing(1)
|
|
56
|
+
},
|
|
57
|
+
'& > .MuiToolbar-root': {
|
|
58
|
+
flex: 'unset',
|
|
59
|
+
padding: 0
|
|
43
60
|
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
'& .RaList-actions': {
|
|
47
|
-
padding: theme.spacing(2),
|
|
48
|
-
paddingTop: 0
|
|
49
|
-
},
|
|
50
|
-
'& .RaList-content': {
|
|
51
|
-
// Resolve an issue related to the visualization of the bulk actions toolbar.
|
|
52
|
-
// Padding and margin create a non empty space that allows the toolbar to be displayed when
|
|
53
|
-
// the selection is empty.
|
|
54
|
-
'& .RaBulkActionsToolbar-collapsed': {
|
|
55
|
-
height: 0,
|
|
56
|
-
paddingTop: 0,
|
|
57
|
-
paddingBottom: 0
|
|
58
61
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
|
|
63
|
+
'& .RaList-content': {
|
|
64
|
+
// Resolve an issue related to the visualization of the bulk actions toolbar.
|
|
65
|
+
// Padding and margin create a non empty space that allows the toolbar to be displayed when
|
|
66
|
+
// the selection is empty.
|
|
67
|
+
'& .RaBulkActionsToolbar-collapsed': {
|
|
68
|
+
height: 0,
|
|
69
|
+
paddingTop: 0,
|
|
70
|
+
paddingBottom: 0
|
|
71
|
+
},
|
|
72
|
+
// Resolve a defect related to the usage of AntDesin icons with Mantis and React-Admin.
|
|
73
|
+
// These two lines are not needed if you are not using AntDesign icons.
|
|
74
|
+
'& .icon span': {
|
|
75
|
+
top: -1,
|
|
76
|
+
left: -1
|
|
77
|
+
}
|
|
64
78
|
}
|
|
65
79
|
},
|
|
80
|
+
|
|
66
81
|
'& .RaEmpty-toolbar': {
|
|
67
82
|
margin: theme.spacing(2)
|
|
68
83
|
}
|