@applica-software-guru/react-admin 1.0.75 → 1.0.77
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/Layout/index.d.ts.map +1 -1
- package/dist/components/ra-forms/ChangePasswordForm.d.ts +2 -1
- package/dist/components/ra-forms/ChangePasswordForm.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 +45 -45
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +15015 -14991
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +50 -50
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Layout/Header/HeaderContent/Profile.jsx +1 -1
- package/src/components/Layout/index.jsx +12 -1
- package/src/components/ra-forms/ChangePasswordForm.tsx +13 -3
- package/src/components/ra-inputs/{LabeledInput.jsx → LabeledInput.tsx} +25 -2
- package/src/components/ra-lists/List.tsx +37 -22
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ const Profile = () => {
|
|
|
27
27
|
const theme = useTheme();
|
|
28
28
|
|
|
29
29
|
const { identity } = useGetIdentity();
|
|
30
|
-
const hasProfilePic = identity !== undefined && identity.image !== null && identity.image !== '';
|
|
30
|
+
const hasProfilePic = identity !== undefined && identity.image && identity.image !== null && identity.image !== '';
|
|
31
31
|
const anchorRef = useRef(null);
|
|
32
32
|
const [open, setOpen] = useState(false);
|
|
33
33
|
const handleToggle = () => {
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import 'simplebar/dist/simplebar.css';
|
|
2
2
|
|
|
3
|
-
import { Box, Container, Toolbar, useMediaQuery } from '@mui/material';
|
|
3
|
+
import { Box, Container, Dialog, Toolbar, useMediaQuery } from '@mui/material';
|
|
4
4
|
import { useBreadcrumbs, useMenuConfig, useThemeConfig } from '../../hooks';
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import Breadcrumbs from '../@extended/Breadcrumbs';
|
|
8
|
+
import { ChangePasswordForm } from '../ra-forms';
|
|
8
9
|
import Drawer from './Drawer';
|
|
9
10
|
import Footer from './Footer';
|
|
10
11
|
import Header from './Header';
|
|
11
12
|
import HorizontalBar from './Drawer/HorizontalBar';
|
|
12
13
|
import { Outlet } from 'react-router-dom';
|
|
13
14
|
import PropTypes from 'prop-types';
|
|
15
|
+
import { useGetIdentity } from 'ra-core';
|
|
14
16
|
import { useTheme } from '@mui/material/styles';
|
|
15
17
|
|
|
16
18
|
const Layout = ({ children, name, version, logoMain, logoIcon, notification, enableNotification }) => {
|
|
17
19
|
const theme = useTheme();
|
|
18
20
|
const { openDrawer } = useMenuConfig();
|
|
19
21
|
const { isLoading, navigation, breadcrumbs } = useBreadcrumbs();
|
|
22
|
+
const { identity } = useGetIdentity();
|
|
23
|
+
const [needToChangePassword, setNeedToChangePassword] = useState(false);
|
|
24
|
+
|
|
20
25
|
const matchDownLG = useMediaQuery(theme.breakpoints.down('xl'));
|
|
21
26
|
const downLG = useMediaQuery(theme.breakpoints.down('lg'));
|
|
22
27
|
const { container, miniDrawer, menuOrientation, isHorizontalLayout } = useThemeConfig();
|
|
@@ -28,6 +33,7 @@ const Layout = ({ children, name, version, logoMain, logoIcon, notification, ena
|
|
|
28
33
|
setOpen(!open);
|
|
29
34
|
openDrawer(!open);
|
|
30
35
|
};
|
|
36
|
+
useEffect(() => setNeedToChangePassword(identity?.needToChangePassword === true), [identity]);
|
|
31
37
|
useEffect(() => {
|
|
32
38
|
if (!miniDrawer) {
|
|
33
39
|
setOpen(!matchDownLG);
|
|
@@ -41,6 +47,8 @@ const Layout = ({ children, name, version, logoMain, logoIcon, notification, ena
|
|
|
41
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
48
|
}, [drawerOpen]);
|
|
43
49
|
|
|
50
|
+
const handlePasswordChange = () => setNeedToChangePassword(false);
|
|
51
|
+
|
|
44
52
|
return (
|
|
45
53
|
<Box sx={{ display: 'flex', width: '100%' }}>
|
|
46
54
|
<Header
|
|
@@ -68,6 +76,9 @@ const Layout = ({ children, name, version, logoMain, logoIcon, notification, ena
|
|
|
68
76
|
flexDirection: 'column'
|
|
69
77
|
}}
|
|
70
78
|
>
|
|
79
|
+
<Dialog open={needToChangePassword} maxWidth="xs" fullWidth>
|
|
80
|
+
<ChangePasswordForm onSuccess={handlePasswordChange} firstAccess />
|
|
81
|
+
</Dialog>
|
|
71
82
|
{!isLoading && (
|
|
72
83
|
<Breadcrumbs
|
|
73
84
|
titleBottom
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Alert, AlertTitle, Grid } from '@mui/material';
|
|
2
|
+
import { EditContextProvider, ResourceContextProvider, required, useAuthProvider, useNotify, useTranslate } from 'ra-core';
|
|
2
3
|
import { useCallback, useState } from 'react';
|
|
3
4
|
|
|
4
|
-
import { Grid } from '@mui/material';
|
|
5
5
|
import { SaveButton } from 'ra-ui-materialui';
|
|
6
6
|
import SimpleForm from './SimpleForm';
|
|
7
7
|
import { TextInput } from '../ra-inputs';
|
|
@@ -10,11 +10,13 @@ import { useThemeConfig } from '../../hooks';
|
|
|
10
10
|
|
|
11
11
|
export type ChangePasswordFormProps = {
|
|
12
12
|
onSuccess: () => void;
|
|
13
|
+
firstAccess?: boolean;
|
|
13
14
|
};
|
|
14
|
-
const ChangePasswordForm = ({ onSuccess }: ChangePasswordFormProps) => {
|
|
15
|
+
const ChangePasswordForm = ({ onSuccess, firstAccess }: ChangePasswordFormProps) => {
|
|
15
16
|
const { spacing } = useThemeConfig();
|
|
16
17
|
const [saving, setSaving] = useState(false);
|
|
17
18
|
const authProvider = useAuthProvider();
|
|
19
|
+
const translate = useTranslate();
|
|
18
20
|
const notify = useNotify();
|
|
19
21
|
const handleSubmit = useCallback(
|
|
20
22
|
(data: any) => {
|
|
@@ -50,6 +52,14 @@ const ChangePasswordForm = ({ onSuccess }: ChangePasswordFormProps) => {
|
|
|
50
52
|
}
|
|
51
53
|
>
|
|
52
54
|
<Grid container spacing={spacing}>
|
|
55
|
+
{firstAccess === true && (
|
|
56
|
+
<Grid item xs={12}>
|
|
57
|
+
<Alert severity="warning">
|
|
58
|
+
<AlertTitle>{translate('ra.auth.first_access.change_password')}</AlertTitle>
|
|
59
|
+
{translate('ra.auth.first_access.change_password_helper')}
|
|
60
|
+
</Alert>
|
|
61
|
+
</Grid>
|
|
62
|
+
)}
|
|
53
63
|
<Grid item xs={12}>
|
|
54
64
|
<TextInput source="oldPassword" type="password" validate={required()} />
|
|
55
65
|
</Grid>
|
|
@@ -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
|
}
|