@applica-software-guru/react-admin 1.1.93 → 1.1.95
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/AuthWrapper.d.ts.map +1 -1
- package/dist/components/Layout/Content.d.ts +5 -0
- package/dist/components/Layout/Content.d.ts.map +1 -0
- package/dist/components/Layout/Drawer/Drawer.d.ts +8 -0
- package/dist/components/Layout/Drawer/Drawer.d.ts.map +1 -0
- package/dist/components/Layout/Drawer/DrawerHeader.d.ts +8 -0
- package/dist/components/Layout/Drawer/DrawerHeader.d.ts.map +1 -0
- package/dist/components/Layout/Drawer/DrawerHeaderStyled.d.ts +4 -0
- package/dist/components/Layout/Drawer/DrawerHeaderStyled.d.ts.map +1 -0
- package/dist/components/Layout/Drawer/index.d.ts +3 -18
- package/dist/components/Layout/Drawer/index.d.ts.map +1 -1
- package/dist/components/Layout/Footer.d.ts +11 -10
- package/dist/components/Layout/Footer.d.ts.map +1 -1
- package/dist/components/Layout/Header/DrawerToggle.d.ts +3 -0
- package/dist/components/Layout/Header/DrawerToggle.d.ts.map +1 -0
- package/dist/components/Layout/Header/Header.d.ts +8 -0
- package/dist/components/Layout/Header/Header.d.ts.map +1 -0
- package/dist/components/Layout/Header/Notification/Notification.d.ts +3 -0
- package/dist/components/Layout/Header/Notification/Notification.d.ts.map +1 -0
- package/dist/components/Layout/Header/Notification/NotificationItem.d.ts +19 -0
- package/dist/components/Layout/Header/Notification/NotificationItem.d.ts.map +1 -0
- package/dist/components/Layout/Header/Notification/index.d.ts +2 -0
- package/dist/components/Layout/Header/Notification/index.d.ts.map +1 -0
- package/dist/components/Layout/Header/Profile/Profile.d.ts.map +1 -0
- package/dist/components/Layout/Header/Profile/buttons/ChangePasswordButton.d.ts.map +1 -0
- package/dist/components/Layout/Header/Profile/buttons/LogoutButton.d.ts.map +1 -0
- package/dist/components/Layout/Header/Profile/buttons/StopImpersonateButton.d.ts.map +1 -0
- package/dist/components/Layout/Header/Profile/buttons/index.d.ts.map +1 -0
- package/dist/components/Layout/Header/Profile/index.d.ts +2 -0
- package/dist/components/Layout/Header/Profile/index.d.ts.map +1 -0
- package/dist/components/Layout/Header/ResponsiveSection.d.ts +5 -0
- package/dist/components/Layout/Header/ResponsiveSection.d.ts.map +1 -0
- package/dist/components/Layout/Header/Spacer.d.ts +5 -0
- package/dist/components/Layout/Header/Spacer.d.ts.map +1 -0
- package/dist/components/Layout/Header/index.d.ts +7 -20
- package/dist/components/Layout/Header/index.d.ts.map +1 -1
- package/dist/components/Layout/HorizontalBar.d.ts +5 -0
- package/dist/components/Layout/HorizontalBar.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts +19 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -0
- package/dist/components/Layout/NavMenu.d.ts +5 -0
- package/dist/components/Layout/NavMenu.d.ts.map +1 -0
- package/dist/components/Layout/Navigation/NavCollapse.d.ts.map +1 -0
- package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavGroup.d.ts +2 -3
- package/dist/components/Layout/Navigation/NavGroup.d.ts.map +1 -0
- package/dist/components/Layout/Navigation/NavItem.d.ts.map +1 -0
- package/dist/components/Layout/Navigation/Navigation.d.ts +7 -0
- package/dist/components/Layout/Navigation/Navigation.d.ts.map +1 -0
- package/dist/components/Layout/Navigation/index.d.ts +2 -0
- package/dist/components/Layout/Navigation/index.d.ts.map +1 -0
- package/dist/components/Layout/Provider.d.ts +84 -0
- package/dist/components/Layout/Provider.d.ts.map +1 -0
- package/dist/components/Layout/Wrapper.d.ts +6 -0
- package/dist/components/Layout/Wrapper.d.ts.map +1 -0
- package/dist/components/Layout/index.d.ts +10 -22
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/ra-inputs/AutocompleteArrayInput.d.ts +1 -0
- package/dist/components/ra-inputs/AutocompleteArrayInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/AutocompleteInput.d.ts +1 -0
- package/dist/components/ra-inputs/AutocompleteInput.d.ts.map +1 -1
- package/dist/components/ra-lists/List.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/mui.d.ts +7 -0
- package/dist/hooks/mui.d.ts.map +1 -0
- package/dist/hooks/useRefDimensions.d.ts +13 -0
- package/dist/hooks/useRefDimensions.d.ts.map +1 -0
- package/dist/react-admin.cjs.js +101 -92
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +23530 -20993
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +102 -93
- package/dist/react-admin.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/AuthWrapper.jsx +1 -1
- package/src/components/Layout/Content.tsx +30 -0
- package/src/components/Layout/Drawer/Drawer.tsx +61 -0
- package/src/components/Layout/Drawer/DrawerHeader.tsx +31 -0
- package/src/components/Layout/Drawer/{DrawerHeader/DrawerHeaderStyled.jsx → DrawerHeaderStyled.jsx} +1 -1
- package/src/components/Layout/Drawer/index.ts +3 -0
- package/src/components/Layout/Footer.tsx +26 -0
- package/src/components/Layout/Header/DrawerToggle.tsx +28 -0
- package/src/components/Layout/Header/Header.tsx +43 -0
- package/src/components/Layout/Header/{HeaderContent/Notification.jsx → Notification/Notification.tsx} +60 -54
- package/src/components/Layout/Header/Notification/NotificationItem.tsx +85 -0
- package/src/components/Layout/Header/Notification/index.ts +1 -0
- package/src/components/Layout/Header/{HeaderContent → Profile}/Profile.jsx +15 -3
- package/src/components/Layout/Header/Profile/index.ts +1 -0
- package/src/components/Layout/Header/{HeaderContent/MobileSection.jsx → ResponsiveSection.tsx} +31 -38
- package/src/components/Layout/Header/Spacer.tsx +9 -0
- package/src/components/Layout/Header/index.ts +7 -0
- package/src/components/Layout/HorizontalBar.tsx +39 -0
- package/src/components/Layout/Layout.tsx +60 -0
- package/src/components/Layout/NavMenu.tsx +12 -0
- package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavCollapse.jsx +7 -8
- package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavGroup.jsx +8 -19
- package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavItem.jsx +7 -8
- package/src/components/Layout/Navigation/Navigation.tsx +76 -0
- package/src/components/Layout/Navigation/index.ts +1 -0
- package/src/components/Layout/Provider.tsx +290 -0
- package/src/components/Layout/Wrapper.tsx +16 -0
- package/src/components/Layout/index.ts +10 -0
- package/src/components/ra-inputs/AutocompleteArrayInput.jsx +5 -2
- package/src/components/ra-inputs/AutocompleteInput.jsx +6 -2
- package/src/components/ra-lists/List.tsx +1 -5
- package/src/hooks/index.jsx +2 -0
- package/src/hooks/mui.ts +21 -0
- package/src/hooks/useRefDimensions.ts +61 -0
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavCollapse.d.ts.map +0 -1
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavGroup.d.ts.map +0 -1
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavItem.d.ts.map +0 -1
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/index.d.ts +0 -3
- package/dist/components/Layout/Drawer/DrawerContent/Navigation/index.d.ts.map +0 -1
- package/dist/components/Layout/Drawer/DrawerContent/index.d.ts +0 -3
- package/dist/components/Layout/Drawer/DrawerContent/index.d.ts.map +0 -1
- package/dist/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.d.ts +0 -5
- package/dist/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.d.ts.map +0 -1
- package/dist/components/Layout/Drawer/DrawerHeader/index.d.ts +0 -15
- package/dist/components/Layout/Drawer/DrawerHeader/index.d.ts.map +0 -1
- package/dist/components/Layout/Drawer/HorizontalBar.d.ts +0 -3
- package/dist/components/Layout/Drawer/HorizontalBar.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/MobileSection.d.ts +0 -3
- package/dist/components/Layout/Header/HeaderContent/MobileSection.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/Notification.d.ts +0 -16
- package/dist/components/Layout/Header/HeaderContent/Notification.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/NotificationItem.d.ts +0 -31
- package/dist/components/Layout/Header/HeaderContent/NotificationItem.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/Profile.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/buttons/ChangePasswordButton.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/buttons/LogoutButton.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/buttons/StopImpersonateButton.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/buttons/index.d.ts.map +0 -1
- package/dist/components/Layout/Header/HeaderContent/index.d.ts +0 -17
- package/dist/components/Layout/Header/HeaderContent/index.d.ts.map +0 -1
- package/src/components/Layout/Drawer/DrawerContent/Navigation/index.jsx +0 -73
- package/src/components/Layout/Drawer/DrawerContent/index.jsx +0 -19
- package/src/components/Layout/Drawer/DrawerHeader/index.jsx +0 -39
- package/src/components/Layout/Drawer/HorizontalBar.jsx +0 -55
- package/src/components/Layout/Drawer/index.jsx +0 -60
- package/src/components/Layout/Footer.jsx +0 -18
- package/src/components/Layout/Header/HeaderContent/NotificationItem.jsx +0 -97
- package/src/components/Layout/Header/HeaderContent/index.jsx +0 -36
- package/src/components/Layout/Header/index.jsx +0 -81
- package/src/components/Layout/index.jsx +0 -114
- /package/dist/components/Layout/Header/{HeaderContent → Profile}/Profile.d.ts +0 -0
- /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.d.ts +0 -0
- /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/LogoutButton.d.ts +0 -0
- /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.d.ts +0 -0
- /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/index.d.ts +0 -0
- /package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavCollapse.d.ts +0 -0
- /package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavItem.d.ts +0 -0
- /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.tsx +0 -0
- /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/LogoutButton.tsx +0 -0
- /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.tsx +0 -0
- /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/index.jsx +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Box, Typography, useMediaQuery } from '@mui/material';
|
|
2
|
-
import { useMenu, useMenuConfig, useThemeConfig } from '../../../../../hooks';
|
|
3
|
-
|
|
4
|
-
import NavGroup from './NavGroup';
|
|
5
|
-
import { useState } from 'react';
|
|
6
|
-
import { useTheme } from '@mui/material/styles';
|
|
7
|
-
|
|
8
|
-
const Navigation = () => {
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
const { menu, isLoading } = useMenu();
|
|
11
|
-
const downLG = useMediaQuery(theme.breakpoints.down('lg'));
|
|
12
|
-
|
|
13
|
-
const { menuOrientation, horizontalMaxItems, isHorizontalLayout } = useThemeConfig();
|
|
14
|
-
const { drawerOpen } = useMenuConfig();
|
|
15
|
-
const [selectedItems, setSelectedItems] = useState('');
|
|
16
|
-
const [selectedLevel, setSelectedLevel] = useState(0);
|
|
17
|
-
const isHorizontal = isHorizontalLayout(menuOrientation) && !downLG;
|
|
18
|
-
const lastItem = isHorizontal ? horizontalMaxItems : null;
|
|
19
|
-
|
|
20
|
-
let lastItemIndex = isLoading ? 0 : menu.length - 1;
|
|
21
|
-
let remItems = [];
|
|
22
|
-
let lastItemId;
|
|
23
|
-
|
|
24
|
-
if (!isLoading && lastItem && lastItem < menu.length) {
|
|
25
|
-
lastItemId = menu[lastItem - 1].id;
|
|
26
|
-
lastItemIndex = lastItem - 1;
|
|
27
|
-
remItems = menu.slice(lastItem - 1, menu.length).map((item) => ({
|
|
28
|
-
title: item.title,
|
|
29
|
-
elements: item.children,
|
|
30
|
-
icon: item.icon
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const navGroups = isLoading
|
|
35
|
-
? []
|
|
36
|
-
: menu.slice(0, lastItemIndex + 1).map((item) => {
|
|
37
|
-
switch (item.type) {
|
|
38
|
-
case 'group':
|
|
39
|
-
return (
|
|
40
|
-
<NavGroup
|
|
41
|
-
key={item.id}
|
|
42
|
-
setSelectedItems={setSelectedItems}
|
|
43
|
-
setSelectedLevel={setSelectedLevel}
|
|
44
|
-
selectedLevel={selectedLevel}
|
|
45
|
-
selectedItems={selectedItems}
|
|
46
|
-
lastItem={lastItem}
|
|
47
|
-
remItems={remItems}
|
|
48
|
-
lastItemId={lastItemId}
|
|
49
|
-
item={item}
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
52
|
-
default:
|
|
53
|
-
return (
|
|
54
|
-
<Typography key={item.id} variant="h6" color="error" align="center">
|
|
55
|
-
Fix - Navigation Group
|
|
56
|
-
</Typography>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
return (
|
|
61
|
-
<Box
|
|
62
|
-
sx={{
|
|
63
|
-
pt: drawerOpen ? (isHorizontal ? 0 : 2) : 0,
|
|
64
|
-
'& > ul:first-of-type': { mt: 0 },
|
|
65
|
-
display: isHorizontal ? { xs: 'block', lg: 'flex' } : 'block'
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
{navGroups}
|
|
69
|
-
</Box>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default Navigation;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Navigation from './Navigation';
|
|
2
|
-
import { SimpleBar } from '../../../third-party';
|
|
3
|
-
|
|
4
|
-
const DrawerContent = () => {
|
|
5
|
-
return (
|
|
6
|
-
<SimpleBar
|
|
7
|
-
sx={{
|
|
8
|
-
'& .simplebar-content': {
|
|
9
|
-
display: 'flex',
|
|
10
|
-
flexDirection: 'column'
|
|
11
|
-
}
|
|
12
|
-
}}
|
|
13
|
-
>
|
|
14
|
-
<Navigation />
|
|
15
|
-
</SimpleBar>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default DrawerContent;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import DrawerHeaderStyled from './DrawerHeaderStyled';
|
|
2
|
-
import Logo from '../../../Logo';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { useMediaQuery } from '@mui/material';
|
|
5
|
-
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
import { useThemeConfig } from '../../../../hooks';
|
|
7
|
-
|
|
8
|
-
const DrawerHeader = ({ open, logoMain, logoIcon }) => {
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
|
|
11
|
-
const downLG = useMediaQuery(theme.breakpoints.down('lg'));
|
|
12
|
-
|
|
13
|
-
const { menuOrientation, isHorizontalLayout } = useThemeConfig();
|
|
14
|
-
const isHorizontal = isHorizontalLayout(menuOrientation) && !downLG;
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<DrawerHeaderStyled
|
|
18
|
-
theme={theme}
|
|
19
|
-
open={open}
|
|
20
|
-
sx={{
|
|
21
|
-
minHeight: isHorizontal ? 'unset' : '60px',
|
|
22
|
-
width: isHorizontal ? { xs: '100%', lg: '424px' } : 'inherit',
|
|
23
|
-
paddingTop: isHorizontal ? { xs: '10px', lg: '0' } : '8px',
|
|
24
|
-
paddingBottom: isHorizontal ? { xs: '18px', lg: '0' } : '8px',
|
|
25
|
-
paddingLeft: isHorizontal ? { xs: '24px', lg: '0' } : open ? '24px' : 0
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<Logo isIcon={!open} sx={{ width: open ? 'auto' : 35, height: 35 }} logoMain={logoMain} logoIcon={logoIcon} />
|
|
29
|
-
</DrawerHeaderStyled>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
DrawerHeader.propTypes = {
|
|
34
|
-
open: PropTypes.bool,
|
|
35
|
-
logoMain: PropTypes.node,
|
|
36
|
-
logoIcon: PropTypes.node
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default DrawerHeader;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { AppBar, Box, Container, useScrollTrigger } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
import Navigation from './DrawerContent/Navigation';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
import { useThemeConfig } from '../../../hooks';
|
|
7
|
-
|
|
8
|
-
function ElevationScroll({ children, window }) {
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
// Note that you normally won't need to set the window ref as useScrollTrigger
|
|
11
|
-
// will default to window.
|
|
12
|
-
// This is only being set here because the demo is in an iframe.
|
|
13
|
-
const trigger = useScrollTrigger({
|
|
14
|
-
disableHysteresis: true,
|
|
15
|
-
threshold: 0,
|
|
16
|
-
target: window
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
theme.shadows[4] = theme.customShadows.z1;
|
|
20
|
-
|
|
21
|
-
return React.cloneElement(children, {
|
|
22
|
-
elevation: trigger ? 4 : 0
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const CustomAppBar = () => {
|
|
27
|
-
const theme = useTheme();
|
|
28
|
-
const { container } = useThemeConfig();
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<ElevationScroll>
|
|
32
|
-
<AppBar
|
|
33
|
-
sx={{
|
|
34
|
-
top: 60,
|
|
35
|
-
bgcolor: theme.palette.background.paper,
|
|
36
|
-
width: '100%',
|
|
37
|
-
height: 62,
|
|
38
|
-
justifyContent: 'center',
|
|
39
|
-
borderTop: `1px solid ${theme.palette.divider}`,
|
|
40
|
-
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
41
|
-
zIndex: 1098,
|
|
42
|
-
color: theme.palette.grey[500]
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<Container maxWidth={container ? 'xl' : false}>
|
|
46
|
-
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
|
47
|
-
<Navigation />
|
|
48
|
-
</Box>
|
|
49
|
-
</Container>
|
|
50
|
-
</AppBar>
|
|
51
|
-
</ElevationScroll>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default CustomAppBar;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Box, Drawer, useMediaQuery } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
import DrawerContent from './DrawerContent';
|
|
4
|
-
import DrawerHeader from './DrawerHeader';
|
|
5
|
-
import MiniDrawerStyled from './MiniDrawerStyled';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
|
-
import { useTheme } from '@mui/material/styles';
|
|
9
|
-
import { useThemeConfig } from '../../../hooks';
|
|
10
|
-
|
|
11
|
-
const MainDrawer = ({ open, handleDrawerToggle, window, logoMain, logoIcon }) => {
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
const matchDownMD = useMediaQuery(theme.breakpoints.down('lg'));
|
|
14
|
-
const container = window !== undefined ? () => window().document.body : undefined;
|
|
15
|
-
const drawerContent = useMemo(() => <DrawerContent />, []);
|
|
16
|
-
const drawerHeader = useMemo(() => <DrawerHeader open={open} logoMain={logoMain} logoIcon={logoIcon} />, [open, logoMain, logoIcon]);
|
|
17
|
-
const { drawerWidth } = useThemeConfig();
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Box component="nav" sx={{ flexShrink: { md: 0 }, zIndex: 1200 }} aria-label="mailbox folders">
|
|
21
|
-
{!matchDownMD ? (
|
|
22
|
-
<MiniDrawerStyled variant="permanent" open={open}>
|
|
23
|
-
{drawerHeader}
|
|
24
|
-
{drawerContent}
|
|
25
|
-
</MiniDrawerStyled>
|
|
26
|
-
) : (
|
|
27
|
-
<Drawer
|
|
28
|
-
container={container}
|
|
29
|
-
variant="temporary"
|
|
30
|
-
open={open}
|
|
31
|
-
onClose={handleDrawerToggle}
|
|
32
|
-
ModalProps={{ keepMounted: true }}
|
|
33
|
-
sx={{
|
|
34
|
-
display: { xs: 'block', lg: 'none' },
|
|
35
|
-
'& .MuiDrawer-paper': {
|
|
36
|
-
boxSizing: 'border-box',
|
|
37
|
-
width: drawerWidth,
|
|
38
|
-
borderRight: `1px solid ${theme.palette.divider}`,
|
|
39
|
-
backgroundImage: 'none',
|
|
40
|
-
boxShadow: 'inherit'
|
|
41
|
-
}
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
{drawerHeader}
|
|
45
|
-
{drawerContent}
|
|
46
|
-
</Drawer>
|
|
47
|
-
)}
|
|
48
|
-
</Box>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
MainDrawer.propTypes = {
|
|
53
|
-
open: PropTypes.bool,
|
|
54
|
-
window: PropTypes.object,
|
|
55
|
-
handleDrawerToggle: PropTypes.func,
|
|
56
|
-
logoMain: PropTypes.node,
|
|
57
|
-
logoIcon: PropTypes.node
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default MainDrawer;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Stack, Typography } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
const Footer = ({ name, version }) => (
|
|
6
|
-
<Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ p: '24px 16px 0px', mt: 'auto' }}>
|
|
7
|
-
<Typography variant="caption">
|
|
8
|
-
© Applica Software Guru for {name} - {version}
|
|
9
|
-
</Typography>
|
|
10
|
-
</Stack>
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
Footer.propTypes = {
|
|
14
|
-
name: PropTypes.string.isRequired,
|
|
15
|
-
version: PropTypes.string.isRequired
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default Footer;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { Avatar, Divider, ListItemAvatar, ListItemButton, ListItemSecondaryAction, ListItemText, Typography } from '@mui/material';
|
|
2
|
-
import { useCallback, useMemo } from 'react';
|
|
3
|
-
import { useLocaleState, useNotify, useRedirect, useUpdate } from 'react-admin';
|
|
4
|
-
|
|
5
|
-
import { MessageOutlined } from '@ant-design/icons';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import dayjs from 'dayjs';
|
|
8
|
-
|
|
9
|
-
const NotificationItem = ({ resource, selected, notification, onClick }) => {
|
|
10
|
-
const notify = useNotify();
|
|
11
|
-
const redirect = useRedirect();
|
|
12
|
-
const [update] = useUpdate(
|
|
13
|
-
resource,
|
|
14
|
-
{
|
|
15
|
-
id: notification?.id,
|
|
16
|
-
data: {
|
|
17
|
-
...notification,
|
|
18
|
-
readed: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
onSuccess: () => {
|
|
23
|
-
if (notification?.resource) {
|
|
24
|
-
if (notification?.resource.startsWith('/')) {
|
|
25
|
-
redirect(notification?.resource);
|
|
26
|
-
onClick();
|
|
27
|
-
} else {
|
|
28
|
-
document.location.href = notification?.resource;
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
onClick();
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
onFailure: () => {
|
|
35
|
-
notify('resources.notifications.messages.readed.error', 'warning');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
const handleClick = useCallback(() => update(), [update]);
|
|
40
|
-
const [locale] = useLocaleState();
|
|
41
|
-
const ago = useMemo(() => dayjs(notification.created).locale(locale).fromNow(), [notification, locale]);
|
|
42
|
-
return (
|
|
43
|
-
<>
|
|
44
|
-
<ListItemButton selected={selected} onClick={handleClick}>
|
|
45
|
-
<ListItemAvatar>
|
|
46
|
-
<Avatar
|
|
47
|
-
sx={{
|
|
48
|
-
color: 'primary.main',
|
|
49
|
-
bgcolor: 'primary.lighter'
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
<MessageOutlined />
|
|
53
|
-
</Avatar>
|
|
54
|
-
</ListItemAvatar>
|
|
55
|
-
<ListItemText
|
|
56
|
-
primary={
|
|
57
|
-
<Typography variant="h6">
|
|
58
|
-
{notification.title}
|
|
59
|
-
<Typography component="span" variant="subtitle1">
|
|
60
|
-
{notification.content}
|
|
61
|
-
</Typography>
|
|
62
|
-
</Typography>
|
|
63
|
-
}
|
|
64
|
-
secondary="2 min ago"
|
|
65
|
-
/>
|
|
66
|
-
<ListItemSecondaryAction>
|
|
67
|
-
<Typography variant="caption" noWrap>
|
|
68
|
-
{ago}
|
|
69
|
-
</Typography>
|
|
70
|
-
</ListItemSecondaryAction>
|
|
71
|
-
</ListItemButton>
|
|
72
|
-
<Divider />
|
|
73
|
-
</>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
NotificationItem.displayName = 'NotificationItem';
|
|
78
|
-
|
|
79
|
-
NotificationItem.defaultProps = {
|
|
80
|
-
resource: 'entities/notification',
|
|
81
|
-
selected: false
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
NotificationItem.propTypes = {
|
|
85
|
-
resource: PropTypes.string.isRequired,
|
|
86
|
-
selected: PropTypes.bool.isRequired,
|
|
87
|
-
notification: PropTypes.shape({
|
|
88
|
-
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
89
|
-
title: PropTypes.string.isRequired,
|
|
90
|
-
content: PropTypes.string.isRequired,
|
|
91
|
-
resource: PropTypes.string,
|
|
92
|
-
readed: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
93
|
-
created: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.instanceOf(Date)]).isRequired
|
|
94
|
-
}).isRequired,
|
|
95
|
-
onClick: PropTypes.func.isRequired
|
|
96
|
-
};
|
|
97
|
-
export default NotificationItem;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Box, useMediaQuery } from '@mui/material';
|
|
2
|
-
import { useMenuConfig, useThemeConfig } from '../../../../hooks';
|
|
3
|
-
|
|
4
|
-
import DrawerHeader from '../../Drawer/DrawerHeader';
|
|
5
|
-
import { LoadingIndicator } from 'react-admin';
|
|
6
|
-
import MobileSection from './MobileSection';
|
|
7
|
-
import Notification from './Notification';
|
|
8
|
-
import Profile from './Profile';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
|
|
11
|
-
const HeaderContent = ({ logoMain, logoIcon, notification, enableNotification }) => {
|
|
12
|
-
const matchesXs = useMediaQuery((theme) => theme.breakpoints.down('md'));
|
|
13
|
-
const { isHorizontalLayout, menuOrientation } = useThemeConfig();
|
|
14
|
-
const { drawerOpen } = useMenuConfig();
|
|
15
|
-
return (
|
|
16
|
-
<>
|
|
17
|
-
{(!drawerOpen || !matchesXs) && isHorizontalLayout(menuOrientation) && <DrawerHeader open logoMain={logoMain} logoIcon={logoIcon} />}
|
|
18
|
-
<Box sx={{ flexGrow: 1 }} />
|
|
19
|
-
{matchesXs && <Box sx={{ width: '100%', ml: 1 }} />}
|
|
20
|
-
|
|
21
|
-
<LoadingIndicator />
|
|
22
|
-
{enableNotification && <Notification resource={notification} />}
|
|
23
|
-
{!matchesXs && <Profile />}
|
|
24
|
-
{matchesXs && <MobileSection />}
|
|
25
|
-
</>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
HeaderContent.propTypes = {
|
|
30
|
-
logoMain: PropTypes.node,
|
|
31
|
-
logoIcon: PropTypes.node,
|
|
32
|
-
notification: PropTypes.string,
|
|
33
|
-
enableNotification: PropTypes.bool
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default HeaderContent;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { AppBar, Toolbar, useMediaQuery } from '@mui/material';
|
|
2
|
-
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
|
|
3
|
-
|
|
4
|
-
import AppBarStyled from './AppBarStyled';
|
|
5
|
-
import HeaderContent from './HeaderContent';
|
|
6
|
-
import { IconButton } from '../../@extended';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import { useMemo } from 'react';
|
|
9
|
-
import { useTheme } from '@mui/material/styles';
|
|
10
|
-
import { useThemeConfig } from '../../../hooks';
|
|
11
|
-
|
|
12
|
-
const Header = ({ open, logoMain, logoIcon, handleDrawerToggle, notification, enableNotification }) => {
|
|
13
|
-
const theme = useTheme();
|
|
14
|
-
const downLG = useMediaQuery(theme.breakpoints.down('lg'));
|
|
15
|
-
const { menuOrientation, isHorizontalLayout } = useThemeConfig();
|
|
16
|
-
|
|
17
|
-
const isHorizontal = isHorizontalLayout(menuOrientation) && !downLG;
|
|
18
|
-
const headerContent = useMemo(
|
|
19
|
-
() => <HeaderContent logoMain={logoMain} logoIcon={logoIcon} notification={notification} enableNotification={enableNotification} />,
|
|
20
|
-
[logoMain, logoIcon, notification]
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const iconBackColorOpen = theme.palette.mode === 'dark' ? 'grey.200' : 'grey.300';
|
|
24
|
-
const iconBackColor = theme.palette.mode === 'dark' ? 'background.default' : 'grey.100';
|
|
25
|
-
|
|
26
|
-
const mainHeader = (
|
|
27
|
-
<Toolbar>
|
|
28
|
-
{!isHorizontal ? (
|
|
29
|
-
<IconButton
|
|
30
|
-
aria-label="open drawer"
|
|
31
|
-
onClick={handleDrawerToggle}
|
|
32
|
-
edge="start"
|
|
33
|
-
color="secondary"
|
|
34
|
-
variant="light"
|
|
35
|
-
sx={{
|
|
36
|
-
color: 'text.primary',
|
|
37
|
-
bgcolor: open ? iconBackColorOpen : iconBackColor,
|
|
38
|
-
ml: { xs: 0, lg: -2 }
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
{!open ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
|
|
42
|
-
</IconButton>
|
|
43
|
-
) : null}
|
|
44
|
-
{headerContent}
|
|
45
|
-
</Toolbar>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const appBar = {
|
|
49
|
-
position: 'fixed',
|
|
50
|
-
color: 'inherit',
|
|
51
|
-
elevation: 0,
|
|
52
|
-
sx: {
|
|
53
|
-
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
54
|
-
zIndex: 1200,
|
|
55
|
-
width: isHorizontal ? '100%' : open ? 'calc(100% - 260px)' : { xs: '100%', lg: 'calc(100% - 60px)' }
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<>
|
|
61
|
-
{!downLG ? (
|
|
62
|
-
<AppBarStyled open={open} {...appBar}>
|
|
63
|
-
{mainHeader}
|
|
64
|
-
</AppBarStyled>
|
|
65
|
-
) : (
|
|
66
|
-
<AppBar {...appBar}>{mainHeader}</AppBar>
|
|
67
|
-
)}
|
|
68
|
-
</>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
Header.propTypes = {
|
|
73
|
-
open: PropTypes.bool,
|
|
74
|
-
handleDrawerToggle: PropTypes.func,
|
|
75
|
-
logoMain: PropTypes.node,
|
|
76
|
-
logoIcon: PropTypes.node,
|
|
77
|
-
notification: PropTypes.string,
|
|
78
|
-
enableNotification: PropTypes.bool
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default Header;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import 'simplebar/dist/simplebar.css';
|
|
2
|
-
|
|
3
|
-
import { Box, Container, Dialog, Toolbar, useMediaQuery } from '@mui/material';
|
|
4
|
-
import { useBreadcrumbs, useMenuConfig, useThemeConfig } from '../../hooks';
|
|
5
|
-
import { useEffect, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import Breadcrumbs from '../@extended/Breadcrumbs';
|
|
8
|
-
import { ChangePasswordForm } from '../ra-forms';
|
|
9
|
-
import Drawer from './Drawer';
|
|
10
|
-
import Footer from './Footer';
|
|
11
|
-
import Header from './Header';
|
|
12
|
-
import HorizontalBar from './Drawer/HorizontalBar';
|
|
13
|
-
import { Outlet } from 'react-router-dom';
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
|
-
import { useGetIdentity } from 'ra-core';
|
|
16
|
-
import { useTheme } from '@mui/material/styles';
|
|
17
|
-
|
|
18
|
-
const Layout = ({ children, name, version, logoMain, logoIcon, notification, enableNotification }) => {
|
|
19
|
-
const theme = useTheme();
|
|
20
|
-
const { openDrawer } = useMenuConfig();
|
|
21
|
-
const { isLoading, navigation, breadcrumbs } = useBreadcrumbs();
|
|
22
|
-
const { identity } = useGetIdentity();
|
|
23
|
-
const [needToChangePassword, setNeedToChangePassword] = useState(false);
|
|
24
|
-
|
|
25
|
-
const matchDownLG = useMediaQuery(theme.breakpoints.down('xl'));
|
|
26
|
-
const downLG = useMediaQuery(theme.breakpoints.down('lg'));
|
|
27
|
-
const { container, miniDrawer, menuOrientation, isHorizontalLayout } = useThemeConfig();
|
|
28
|
-
|
|
29
|
-
const { drawerOpen } = useMenuConfig();
|
|
30
|
-
const isHorizontal = isHorizontalLayout(menuOrientation) && !downLG;
|
|
31
|
-
const [open, setOpen] = useState(!miniDrawer || drawerOpen);
|
|
32
|
-
const handleDrawerToggle = () => {
|
|
33
|
-
setOpen(!open);
|
|
34
|
-
openDrawer(!open);
|
|
35
|
-
};
|
|
36
|
-
useEffect(() => setNeedToChangePassword(identity?.needToChangePassword === true), [identity]);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (!miniDrawer) {
|
|
39
|
-
setOpen(!matchDownLG);
|
|
40
|
-
openDrawer(!matchDownLG);
|
|
41
|
-
}
|
|
42
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
-
}, [matchDownLG]);
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (open !== drawerOpen) setOpen(drawerOpen);
|
|
47
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
-
}, [drawerOpen]);
|
|
49
|
-
|
|
50
|
-
const handlePasswordChange = () => setNeedToChangePassword(false);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Box sx={{ display: 'flex', width: '100%' }}>
|
|
54
|
-
<Header
|
|
55
|
-
open={open}
|
|
56
|
-
handleDrawerToggle={handleDrawerToggle}
|
|
57
|
-
logoMain={logoMain}
|
|
58
|
-
logoIcon={logoIcon}
|
|
59
|
-
notification={notification}
|
|
60
|
-
enableNotification={enableNotification}
|
|
61
|
-
/>
|
|
62
|
-
{!isHorizontal ? (
|
|
63
|
-
<Drawer open={open} handleDrawerToggle={handleDrawerToggle} logoMain={logoMain} logoIcon={logoIcon} />
|
|
64
|
-
) : (
|
|
65
|
-
<HorizontalBar />
|
|
66
|
-
)}
|
|
67
|
-
<Box component="main" sx={{ width: 'calc(100% - 260px)', flexGrow: 1, p: { xs: 0, sm: 2, lg: 1 }, pt: { lg: 2 } }}>
|
|
68
|
-
<Toolbar sx={{ mt: isHorizontal ? 8 : 'inherit' }} />
|
|
69
|
-
<Container
|
|
70
|
-
maxWidth={container ? 'xl' : false}
|
|
71
|
-
sx={{
|
|
72
|
-
...(container && { px: { xs: 0, sm: 2 } }),
|
|
73
|
-
position: 'relative',
|
|
74
|
-
minHeight: 'calc(100vh - 110px)',
|
|
75
|
-
display: 'flex',
|
|
76
|
-
flexDirection: 'column'
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<Dialog open={needToChangePassword} maxWidth="xs" fullWidth>
|
|
80
|
-
<ChangePasswordForm onSuccess={handlePasswordChange} firstAccess />
|
|
81
|
-
</Dialog>
|
|
82
|
-
{!isLoading && (
|
|
83
|
-
<Breadcrumbs
|
|
84
|
-
titleBottom
|
|
85
|
-
mode="breadcrumbs"
|
|
86
|
-
navigation={navigation}
|
|
87
|
-
breadcrumbs={breadcrumbs}
|
|
88
|
-
card={false}
|
|
89
|
-
divider={false}
|
|
90
|
-
icon
|
|
91
|
-
icons
|
|
92
|
-
home={false}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
{children}
|
|
96
|
-
<Outlet />
|
|
97
|
-
<Footer name={name} version={version} />
|
|
98
|
-
</Container>
|
|
99
|
-
</Box>
|
|
100
|
-
</Box>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
Layout.propTypes = {
|
|
105
|
-
name: PropTypes.string,
|
|
106
|
-
version: PropTypes.string,
|
|
107
|
-
children: PropTypes.node,
|
|
108
|
-
logoMain: PropTypes.node,
|
|
109
|
-
logoIcon: PropTypes.node,
|
|
110
|
-
notification: PropTypes.string,
|
|
111
|
-
enableNotification: PropTypes.bool
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export default Layout;
|
|
File without changes
|
/package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavCollapse.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.tsx
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.tsx
RENAMED
|
File without changes
|
|
File without changes
|