@applica-software-guru/react-admin 1.3.138 → 1.3.140
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/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Layout/Header/Notification/Notification.d.ts.map +1 -1
- package/dist/components/Layout/Header/Notification/NotificationItem.d.ts.map +1 -1
- package/dist/hooks/useMenu.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +37 -37
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +2203 -2176
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +29 -29
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Layout/Drawer/Drawer.tsx +2 -1
- package/src/components/Layout/Header/Notification/Notification.tsx +39 -5
- package/src/components/Layout/Header/Notification/NotificationItem.tsx +2 -0
- package/src/hooks/useMenu.jsx +5 -1
- package/vite.config.js +3 -1
package/package.json
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Badge,
|
|
4
|
+
Box,
|
|
5
|
+
ClickAwayListener,
|
|
6
|
+
Divider,
|
|
7
|
+
List,
|
|
8
|
+
ListItemButton,
|
|
9
|
+
ListItemText,
|
|
10
|
+
Paper,
|
|
11
|
+
Popper,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Typography,
|
|
14
|
+
useTheme
|
|
15
|
+
} from '@mui/material';
|
|
3
16
|
import { useLayoutMediaState, useLayoutNotificationsState, useLayoutThemeState } from '../../Provider';
|
|
4
17
|
import { IconButton, Transitions } from '../../../@extended';
|
|
5
18
|
import { BellOutlined, CheckCircleOutlined } from '@ant-design/icons';
|
|
6
|
-
import { useGetList } from 'ra-core';
|
|
19
|
+
import { useGetList, useTranslate } from 'ra-core';
|
|
7
20
|
import MainCard from '../../../MainCard';
|
|
8
21
|
import { HeaderNotificationItem, INotification } from './NotificationItem';
|
|
22
|
+
import { Link } from 'react-router-dom';
|
|
9
23
|
|
|
10
24
|
const avatarSX = {
|
|
11
25
|
width: 36,
|
|
@@ -32,6 +46,7 @@ function HeaderNotification() {
|
|
|
32
46
|
function HeaderNotificationButton() {
|
|
33
47
|
const theme = useTheme(),
|
|
34
48
|
anchorRef = useRef(),
|
|
49
|
+
translate = useTranslate(),
|
|
35
50
|
{ resource } = useLayoutNotificationsState(),
|
|
36
51
|
{ downMd } = useLayoutMediaState(),
|
|
37
52
|
{ iconColor, iconColorOpen } = useLayoutThemeState(),
|
|
@@ -44,10 +59,11 @@ function HeaderNotificationButton() {
|
|
|
44
59
|
if (anchorRef.current && anchorRef.current.contains(event.target)) {
|
|
45
60
|
return;
|
|
46
61
|
}
|
|
62
|
+
|
|
47
63
|
setNotificationOpen(false);
|
|
48
64
|
}, [anchorRef.current, setNotificationOpen]),
|
|
49
65
|
{ data, isLoading } = useGetList<INotification>(resource, {
|
|
50
|
-
pagination: { page: 1, perPage:
|
|
66
|
+
pagination: { page: 1, perPage: 25 },
|
|
51
67
|
sort: { field: 'created', order: 'DESC' },
|
|
52
68
|
filter: {
|
|
53
69
|
readed: false
|
|
@@ -138,7 +154,9 @@ function HeaderNotificationButton() {
|
|
|
138
154
|
'&.Mui-selected': { bgcolor: 'grey.50', color: 'text.primary' },
|
|
139
155
|
'& .MuiAvatar-root': avatarSX,
|
|
140
156
|
'& .MuiListItemSecondaryAction-root': { ...actionSX, position: 'relative' }
|
|
141
|
-
}
|
|
157
|
+
},
|
|
158
|
+
maxHeight: 'calc(100vh - 240px)',
|
|
159
|
+
overflow: 'auto'
|
|
142
160
|
}}
|
|
143
161
|
>
|
|
144
162
|
{notifications.map((item, index) => (
|
|
@@ -146,11 +164,27 @@ function HeaderNotificationButton() {
|
|
|
146
164
|
key={item.id}
|
|
147
165
|
selected={read > 0}
|
|
148
166
|
notification={item}
|
|
149
|
-
onClick={
|
|
167
|
+
onClick={handleToggle}
|
|
150
168
|
divider={index < notifications.length - 1}
|
|
151
169
|
/>
|
|
152
170
|
))}
|
|
153
171
|
</List>
|
|
172
|
+
<Divider />
|
|
173
|
+
{/*@ts-ignore*/}
|
|
174
|
+
<ListItemButton
|
|
175
|
+
sx={{ textAlign: 'center', py: `${12}px !important` }}
|
|
176
|
+
to={`/${resource}`}
|
|
177
|
+
LinkComponent={Link}
|
|
178
|
+
onClick={handleClose}
|
|
179
|
+
>
|
|
180
|
+
<ListItemText
|
|
181
|
+
primary={
|
|
182
|
+
<Typography variant="h6" color="primary">
|
|
183
|
+
{translate('ra.notification.view_all')}
|
|
184
|
+
</Typography>
|
|
185
|
+
}
|
|
186
|
+
/>
|
|
187
|
+
</ListItemButton>
|
|
154
188
|
</MainCard>
|
|
155
189
|
</ClickAwayListener>
|
|
156
190
|
</Paper>
|
|
@@ -37,11 +37,13 @@ function HeaderNotificationItem(props: IHeaderNotificationItemProps) {
|
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
onSuccess: () => {
|
|
40
|
+
// eslint-disable-next-line no-console
|
|
40
41
|
if (notification?.resource) {
|
|
41
42
|
if (notification?.resource.startsWith('/')) {
|
|
42
43
|
redirect(notification?.resource);
|
|
43
44
|
onClick();
|
|
44
45
|
} else {
|
|
46
|
+
onClick();
|
|
45
47
|
document.location.href = notification?.resource;
|
|
46
48
|
}
|
|
47
49
|
} else {
|
package/src/hooks/useMenu.jsx
CHANGED
|
@@ -109,7 +109,11 @@ const createNodes = ({ userGroups, resources, permissions, translate, roles }) =
|
|
|
109
109
|
if (group.children) {
|
|
110
110
|
group.children = group.children.filter((child) => {
|
|
111
111
|
if (child.resource === false) {
|
|
112
|
-
|
|
112
|
+
const childRoles = child.roles || [];
|
|
113
|
+
if (childRoles.length === 0 || childRoles.some((role) => roles.includes(role))) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
113
117
|
}
|
|
114
118
|
if (child.type === 'item') {
|
|
115
119
|
return resources.includes(child.id);
|
package/vite.config.js
CHANGED
|
@@ -55,7 +55,8 @@ export default defineConfig((configEnv) => ({
|
|
|
55
55
|
'react-query',
|
|
56
56
|
'react-router-dom',
|
|
57
57
|
'react-router',
|
|
58
|
-
'react/jsx-runtime'
|
|
58
|
+
'react/jsx-runtime',
|
|
59
|
+
'react-refresh'
|
|
59
60
|
]),
|
|
60
61
|
output: {
|
|
61
62
|
globals: {
|
|
@@ -75,6 +76,7 @@ export default defineConfig((configEnv) => ({
|
|
|
75
76
|
'react-router-dom': 'react-router-dom',
|
|
76
77
|
'react-router': 'react-router',
|
|
77
78
|
'react/jsx-runtime': 'react/jsx-runtime',
|
|
79
|
+
'react-refresh': 'react-refresh',
|
|
78
80
|
react: 'React'
|
|
79
81
|
}
|
|
80
82
|
}
|