@applica-software-guru/react-admin 1.3.175 → 1.3.177
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/ApplicaAdmin.d.ts +0 -1
- package/dist/ApplicaAdmin.d.ts.map +1 -1
- package/dist/components/@extended/Breadcrumbs.d.ts +0 -28
- package/dist/components/@extended/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/Layout/Navigation/NavCollapse.d.ts +10 -21
- package/dist/components/Layout/Navigation/NavCollapse.d.ts.map +1 -1
- package/dist/components/Layout/Navigation/NavGroup.d.ts +24 -22
- package/dist/components/Layout/Navigation/NavGroup.d.ts.map +1 -1
- package/dist/components/Layout/Navigation/NavItem.d.ts +5 -11
- package/dist/components/Layout/Navigation/NavItem.d.ts.map +1 -1
- package/dist/components/Layout/Navigation/NavList.d.ts +9 -0
- package/dist/components/Layout/Navigation/NavList.d.ts.map +1 -0
- package/dist/components/Layout/Navigation/Navigation.d.ts.map +1 -1
- package/dist/components/Layout/Navigation/index.d.ts +4 -0
- package/dist/components/Layout/Navigation/index.d.ts.map +1 -1
- package/dist/components/MainCard.d.ts.map +1 -1
- package/dist/components/Notification.d.ts +2 -2
- package/dist/components/ra-fields/ReadonlyField.d.ts.map +1 -1
- package/dist/components/ra-fields/ReferenceManyField.d.ts +1 -36
- package/dist/components/ra-fields/ReferenceManyField.d.ts.map +1 -1
- package/dist/components/ra-forms/Create.d.ts.map +1 -1
- package/dist/components/ra-forms/Edit.d.ts.map +1 -1
- package/dist/components/ra-forms/LongForm/BaseForm.d.ts.map +1 -1
- package/dist/components/ra-forms/SimpleForm.d.ts.map +1 -1
- package/dist/components/ra-forms/TabbedForm.d.ts +12 -3
- package/dist/components/ra-forms/TabbedForm.d.ts.map +1 -1
- package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts +2 -1
- package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts.map +1 -1
- package/dist/components/ra-forms/TableForm/TableFormIteratorItem.d.ts.map +1 -1
- package/dist/components/ra-inputs/BooleanInput.d.ts +1 -2
- package/dist/components/ra-inputs/BooleanInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/LabeledInput.d.ts +0 -5
- package/dist/components/ra-inputs/LabeledInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/ReferenceManyInput.d.ts +2 -27
- package/dist/components/ra-inputs/ReferenceManyInput.d.ts.map +1 -1
- package/dist/components/ra-inputs/SelectInput.d.ts +1 -24
- package/dist/components/ra-inputs/SelectInput.d.ts.map +1 -1
- package/dist/components/ra-lists/Datagrid/index.d.ts.map +1 -1
- package/dist/components/ra-lists/List.d.ts.map +1 -1
- package/dist/components/ra-lists/NotificationList/NotificationList.d.ts.map +1 -1
- package/dist/components/ra-lists/SimpleList.d.ts +15 -0
- package/dist/components/ra-lists/SimpleList.d.ts.map +1 -0
- package/dist/components/ra-lists/index.d.ts +4 -3
- package/dist/components/ra-lists/index.d.ts.map +1 -1
- package/dist/contexts/MenuConfigContext.d.ts +2 -26
- package/dist/contexts/MenuConfigContext.d.ts.map +1 -1
- package/dist/contexts/ThemeConfigContext.d.ts +10 -0
- package/dist/contexts/ThemeConfigContext.d.ts.map +1 -1
- package/dist/contexts/index.d.ts +0 -2
- package/dist/contexts/index.d.ts.map +1 -1
- package/dist/hooks/useMenuConfig.d.ts +1 -9
- package/dist/hooks/useMenuConfig.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/react-admin.cjs.js +59 -59
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +7315 -7299
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +64 -64
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/ApplicaAdmin.tsx +1 -24
- package/src/components/@extended/Breadcrumbs.jsx +0 -20
- package/src/components/Layout/Navigation/{NavCollapse.jsx → NavCollapse.tsx} +25 -20
- package/src/components/Layout/Navigation/{NavGroup.jsx → NavGroup.tsx} +35 -11
- package/src/components/Layout/Navigation/{NavItem.jsx → NavItem.tsx} +12 -9
- package/src/components/Layout/Navigation/NavList.tsx +23 -0
- package/src/components/Layout/Navigation/Navigation.tsx +7 -13
- package/src/components/Layout/Navigation/index.ts +4 -0
- package/src/components/MainCard.tsx +1 -7
- package/src/components/ra-fields/ReadonlyField.tsx +6 -1
- package/src/components/ra-fields/ReferenceManyField.tsx +40 -58
- package/src/components/ra-forms/Create.tsx +5 -2
- package/src/components/ra-forms/Edit.jsx +3 -0
- package/src/components/ra-forms/FormHeader.tsx +2 -2
- package/src/components/ra-forms/LongForm/BaseForm.tsx +9 -5
- package/src/components/ra-forms/SimpleForm.tsx +4 -3
- package/src/components/ra-forms/TabbedForm.tsx +51 -12
- package/src/components/ra-forms/TableForm/TableFormIterator.tsx +31 -15
- package/src/components/ra-forms/TableForm/TableFormIteratorItem.tsx +10 -9
- package/src/components/ra-inputs/AutocompleteArrayInput.jsx +3 -3
- package/src/components/ra-inputs/AutocompleteInput.jsx +3 -3
- package/src/components/ra-inputs/BooleanInput.jsx +16 -29
- package/src/components/ra-inputs/LabeledInput.tsx +1 -6
- package/src/components/ra-inputs/SelectArrayInput.jsx +3 -3
- package/src/components/ra-inputs/SelectInput.tsx +4 -9
- package/src/components/ra-lists/Datagrid/index.tsx +8 -2
- package/src/components/ra-lists/List.tsx +26 -12
- package/src/components/ra-lists/NotificationList/NotificationList.jsx +7 -10
- package/src/components/ra-lists/SimpleList.tsx +13 -0
- package/src/components/ra-lists/index.ts +4 -3
- package/src/contexts/MenuConfigContext.tsx +15 -12
- package/src/contexts/ThemeConfigContext.tsx +28 -2
- package/src/contexts/index.jsx +0 -2
- package/src/index.jsx +8 -8
- package/dist/contexts/MenuPropTypes.d.ts +0 -13
- package/dist/contexts/MenuPropTypes.d.ts.map +0 -1
- package/src/contexts/MenuPropTypes.jsx +0 -20
- /package/src/hooks/{useMenuConfig.jsx → useMenuConfig.ts} +0 -0
package/package.json
CHANGED
package/src/ApplicaAdmin.tsx
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { AdminProps, AuthProvider, DataProvider } from 'react-admin';
|
|
2
|
-
import { AppConfigProvider, MenuConfigProvider,
|
|
2
|
+
import { AppConfigProvider, MenuConfigProvider, ThemeConfig, ThemeConfigProvider } from './contexts';
|
|
3
3
|
import { CatchResult, useErrorEventCatcher } from './dev';
|
|
4
4
|
import { GenericErrorPage, Layout, LoginPage, MainIcon, Notification, SmallIcon } from './components';
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
import { useI18nProvider } from './i18n';
|
|
7
7
|
import Admin from './Admin';
|
|
8
8
|
import { MenuProps } from './types';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
9
|
import { QueryClient } from 'react-query';
|
|
11
10
|
import { ThemeCustomization } from './themes';
|
|
12
11
|
import { IErrorEventHandler } from './dev/ErrorEventHandler';
|
|
@@ -293,26 +292,4 @@ ApplicaAdmin.defaultProps = {
|
|
|
293
292
|
queryClient: defaultQueryClient,
|
|
294
293
|
enableThemeToggler: false
|
|
295
294
|
};
|
|
296
|
-
|
|
297
|
-
ApplicaAdmin.propTypes = {
|
|
298
|
-
...Admin.propTypes,
|
|
299
|
-
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
|
300
|
-
apiUrl: PropTypes.string.isRequired,
|
|
301
|
-
defaultLocale: PropTypes.string,
|
|
302
|
-
development: PropTypes.bool,
|
|
303
|
-
logoMain: PropTypes.node,
|
|
304
|
-
logoIcon: PropTypes.node,
|
|
305
|
-
menu: PropTypes.arrayOf(MenuPropTypes),
|
|
306
|
-
name: PropTypes.string,
|
|
307
|
-
version: PropTypes.string,
|
|
308
|
-
authProvider: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
309
|
-
dataProvider: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
310
|
-
notification: PropTypes.string,
|
|
311
|
-
enableNotification: PropTypes.bool,
|
|
312
|
-
enableRegistration: PropTypes.bool,
|
|
313
|
-
enableForgotPassword: PropTypes.bool,
|
|
314
|
-
queryClient: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
315
|
-
enableThemeToggler: PropTypes.bool
|
|
316
|
-
};
|
|
317
|
-
|
|
318
295
|
export default ApplicaAdmin;
|
|
@@ -4,9 +4,7 @@ import { Link, useLocation } from 'react-router-dom';
|
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import MainCard from '../MainCard';
|
|
7
|
-
import { MenuPropTypes } from '../../contexts';
|
|
8
7
|
import MuiBreadcrumbs from '@mui/material/Breadcrumbs';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
8
|
import { useTheme } from '@mui/material/styles';
|
|
11
9
|
|
|
12
10
|
const renderBreadcrumb = ({ id, title, icon, url, last }) => {
|
|
@@ -283,22 +281,4 @@ Breadcrumbs.defaultProps = {
|
|
|
283
281
|
home: 'Home',
|
|
284
282
|
mode: 'navigation'
|
|
285
283
|
};
|
|
286
|
-
|
|
287
|
-
Breadcrumbs.propTypes = {
|
|
288
|
-
home: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
289
|
-
card: PropTypes.bool,
|
|
290
|
-
divider: PropTypes.bool,
|
|
291
|
-
icon: PropTypes.bool,
|
|
292
|
-
icons: PropTypes.bool,
|
|
293
|
-
maxItems: PropTypes.number,
|
|
294
|
-
navigation: PropTypes.object,
|
|
295
|
-
rightAlign: PropTypes.bool,
|
|
296
|
-
separator: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
297
|
-
title: PropTypes.bool,
|
|
298
|
-
titleBottom: PropTypes.bool,
|
|
299
|
-
sx: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
300
|
-
breadcrumbs: PropTypes.arrayOf(MenuPropTypes),
|
|
301
|
-
mode: PropTypes.oneOf(['navigation', 'breadcrumbs'])
|
|
302
|
-
};
|
|
303
|
-
|
|
304
284
|
export default Breadcrumbs;
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
ListItemText,
|
|
10
10
|
Paper,
|
|
11
11
|
Popper,
|
|
12
|
-
Typography
|
|
12
|
+
Typography,
|
|
13
|
+
Theme
|
|
13
14
|
} from '@mui/material';
|
|
14
15
|
import { Dot, Transitions } from '../../@extended';
|
|
15
16
|
import { styled, useTheme } from '@mui/material/styles';
|
|
@@ -17,11 +18,10 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
17
18
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
18
19
|
|
|
19
20
|
import NavItem from './NavItem';
|
|
20
|
-
import PropTypes from 'prop-types';
|
|
21
21
|
import { useLayoutMediaState } from '../Provider';
|
|
22
22
|
import { useMenuConfig } from '../../../hooks';
|
|
23
23
|
|
|
24
|
-
const PopperStyled = styled(Popper)(({ theme }) => ({
|
|
24
|
+
const PopperStyled = styled(Popper)(({ theme }: { theme: Theme }) => ({
|
|
25
25
|
overflow: 'visible',
|
|
26
26
|
zIndex: 1202,
|
|
27
27
|
minWidth: 180,
|
|
@@ -36,12 +36,24 @@ const PopperStyled = styled(Popper)(({ theme }) => ({
|
|
|
36
36
|
backgroundColor: theme.palette.background.paper,
|
|
37
37
|
transform: 'translateY(-50%) rotate(45deg)',
|
|
38
38
|
zIndex: 120,
|
|
39
|
+
// @ts-ignore
|
|
39
40
|
borderLeft: `1px solid ${theme.palette.grey.A800}`,
|
|
41
|
+
// @ts-ignore
|
|
40
42
|
borderBottom: `1px solid ${theme.palette.grey.A800}`
|
|
41
43
|
}
|
|
42
44
|
}));
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
export type NavCollapseProps = {
|
|
47
|
+
menu: any;
|
|
48
|
+
level: number;
|
|
49
|
+
parentId: string;
|
|
50
|
+
setSelectedItems: (value: string) => void;
|
|
51
|
+
selectedItems: string;
|
|
52
|
+
setSelectedLevel: (value: number) => void;
|
|
53
|
+
selectedLevel: number;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, setSelectedLevel, selectedLevel }: NavCollapseProps) => {
|
|
45
57
|
const theme = useTheme();
|
|
46
58
|
const { activeItem } = useMenuConfig();
|
|
47
59
|
const { horizontal } = useLayoutMediaState();
|
|
@@ -53,7 +65,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
53
65
|
|
|
54
66
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
55
67
|
|
|
56
|
-
const handleClick = (event) => {
|
|
68
|
+
const handleClick = (event: any) => {
|
|
57
69
|
setAnchorEl(null);
|
|
58
70
|
setSelectedLevel(level);
|
|
59
71
|
if (drawerOpen) {
|
|
@@ -72,7 +84,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
72
84
|
}
|
|
73
85
|
};
|
|
74
86
|
|
|
75
|
-
const handleHover = (event) => {
|
|
87
|
+
const handleHover = (event: any) => {
|
|
76
88
|
setAnchorEl(event?.currentTarget);
|
|
77
89
|
};
|
|
78
90
|
|
|
@@ -98,8 +110,8 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
98
110
|
const { pathname } = useLocation();
|
|
99
111
|
const openMini = Boolean(anchorEl);
|
|
100
112
|
|
|
101
|
-
const checkOpenForParent = (child, id) => {
|
|
102
|
-
child.forEach((item) => {
|
|
113
|
+
const checkOpenForParent = (child: any, id: any) => {
|
|
114
|
+
child.forEach((item: any) => {
|
|
103
115
|
if (item.url === pathname) {
|
|
104
116
|
setOpen(true);
|
|
105
117
|
setSelected(id);
|
|
@@ -112,7 +124,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
112
124
|
setSelected(null);
|
|
113
125
|
if (openMini) setAnchorEl(null);
|
|
114
126
|
if (menu.children) {
|
|
115
|
-
menu.children.forEach((item) => {
|
|
127
|
+
menu.children.forEach((item: any) => {
|
|
116
128
|
if (item.children?.length) {
|
|
117
129
|
checkOpenForParent(item.children, menu.id);
|
|
118
130
|
}
|
|
@@ -139,7 +151,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
139
151
|
}
|
|
140
152
|
}, [pathname, menu, selected, activeItem]);
|
|
141
153
|
|
|
142
|
-
const navCollapse = menu.children?.map((item) => {
|
|
154
|
+
const navCollapse = menu.children?.map((item: any) => {
|
|
143
155
|
switch (item.type) {
|
|
144
156
|
case 'collapse':
|
|
145
157
|
return (
|
|
@@ -288,11 +300,13 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
288
300
|
}}
|
|
289
301
|
>
|
|
290
302
|
{({ TransitionProps }) => (
|
|
303
|
+
// @ts-ignore
|
|
291
304
|
<Transitions in={openMini} {...TransitionProps}>
|
|
292
305
|
<Paper
|
|
293
306
|
sx={{
|
|
294
307
|
overflow: 'hidden',
|
|
295
308
|
mt: 1.5,
|
|
309
|
+
// @ts-ignore
|
|
296
310
|
boxShadow: theme.customShadows.z1,
|
|
297
311
|
backgroundImage: 'none',
|
|
298
312
|
border: `1px solid ${theme.palette.divider}`
|
|
@@ -382,6 +396,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
382
396
|
]}
|
|
383
397
|
>
|
|
384
398
|
{({ TransitionProps }) => (
|
|
399
|
+
// @ts-ignore
|
|
385
400
|
<Transitions in={openMini} {...TransitionProps}>
|
|
386
401
|
<Paper
|
|
387
402
|
sx={{
|
|
@@ -407,14 +422,4 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
|
|
|
407
422
|
);
|
|
408
423
|
};
|
|
409
424
|
|
|
410
|
-
NavCollapse.propTypes = {
|
|
411
|
-
menu: PropTypes.object,
|
|
412
|
-
level: PropTypes.number,
|
|
413
|
-
parentId: PropTypes.string,
|
|
414
|
-
setSelectedItems: PropTypes.func,
|
|
415
|
-
selectedItems: PropTypes.string,
|
|
416
|
-
setSelectedLevel: PropTypes.func,
|
|
417
|
-
selectedLevel: PropTypes.number
|
|
418
|
-
};
|
|
419
|
-
|
|
420
425
|
export default NavCollapse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, ClickAwayListener, List, ListItemButton, ListItemIcon, ListItemText, Paper, Popper, Typography } from '@mui/material';
|
|
1
|
+
import { Box, ClickAwayListener, List, ListItemButton, ListItemIcon, ListItemText, Paper, Popper, Typography, Theme } from '@mui/material';
|
|
2
2
|
import { DownOutlined, RightOutlined } from '@ant-design/icons';
|
|
3
3
|
import { Fragment, useEffect, useState } from 'react';
|
|
4
4
|
import { styled, useTheme } from '@mui/material/styles';
|
|
@@ -11,7 +11,10 @@ import { Transitions } from '../../@extended';
|
|
|
11
11
|
import { useTranslate } from 'react-admin';
|
|
12
12
|
import { useLayoutMediaState } from '../Provider';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
type PopperStyledProps = {
|
|
15
|
+
theme: Theme;
|
|
16
|
+
};
|
|
17
|
+
const PopperStyled = styled(Popper)(({ theme }: PopperStyledProps) => ({
|
|
15
18
|
overflow: 'visible',
|
|
16
19
|
zIndex: 1202,
|
|
17
20
|
minWidth: 180,
|
|
@@ -31,7 +34,27 @@ const PopperStyled = styled(Popper)(({ theme }) => ({
|
|
|
31
34
|
}
|
|
32
35
|
}));
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
export type NavGroupProps = {
|
|
38
|
+
item: any;
|
|
39
|
+
lastItem?: number | undefined;
|
|
40
|
+
remItems: any[];
|
|
41
|
+
lastItemId: string;
|
|
42
|
+
setSelectedItems: (value: string) => void;
|
|
43
|
+
selectedItems: string;
|
|
44
|
+
setSelectedLevel: (value: number) => void;
|
|
45
|
+
selectedLevel: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const NavGroup = ({
|
|
49
|
+
item,
|
|
50
|
+
lastItem,
|
|
51
|
+
remItems,
|
|
52
|
+
lastItemId,
|
|
53
|
+
setSelectedItems,
|
|
54
|
+
selectedItems,
|
|
55
|
+
setSelectedLevel,
|
|
56
|
+
selectedLevel
|
|
57
|
+
}: NavGroupProps) => {
|
|
35
58
|
const theme = useTheme();
|
|
36
59
|
const translate = useTranslate();
|
|
37
60
|
const { pathname } = { pathname: '' }; // useLocation()
|
|
@@ -58,8 +81,8 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
|
|
|
58
81
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
82
|
}, [item, lastItem, downLg]);
|
|
60
83
|
|
|
61
|
-
const checkOpenForParent = (child, id) => {
|
|
62
|
-
child.forEach((ele) => {
|
|
84
|
+
const checkOpenForParent = (child: any, id: any) => {
|
|
85
|
+
child.forEach((ele: any) => {
|
|
63
86
|
if (ele.children?.length) {
|
|
64
87
|
checkOpenForParent(ele.children, currentItem.id);
|
|
65
88
|
}
|
|
@@ -68,9 +91,9 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
|
|
|
68
91
|
}
|
|
69
92
|
});
|
|
70
93
|
};
|
|
71
|
-
const checkSelectedOnload = (data) => {
|
|
94
|
+
const checkSelectedOnload = (data: any) => {
|
|
72
95
|
const childrens = data.children ? data.children : [];
|
|
73
|
-
childrens.forEach((itemCheck) => {
|
|
96
|
+
childrens.forEach((itemCheck: any) => {
|
|
74
97
|
if (itemCheck.children?.length) {
|
|
75
98
|
checkOpenForParent(itemCheck.children, currentItem.id);
|
|
76
99
|
}
|
|
@@ -86,7 +109,7 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
|
|
|
86
109
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
110
|
}, [pathname, currentItem]);
|
|
88
111
|
|
|
89
|
-
const handleClick = (event) => {
|
|
112
|
+
const handleClick = (event: any) => {
|
|
90
113
|
if (!openMini) {
|
|
91
114
|
setAnchorEl(event?.currentTarget);
|
|
92
115
|
}
|
|
@@ -107,7 +130,7 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
|
|
|
107
130
|
/>
|
|
108
131
|
) : null;
|
|
109
132
|
|
|
110
|
-
const navCollapse = item.children?.map((menuItem) => {
|
|
133
|
+
const navCollapse = item.children?.map((menuItem: any) => {
|
|
111
134
|
switch (menuItem.type) {
|
|
112
135
|
case 'collapse':
|
|
113
136
|
return (
|
|
@@ -135,7 +158,7 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
|
|
|
135
158
|
{itemRem.title}
|
|
136
159
|
</Typography>
|
|
137
160
|
)}
|
|
138
|
-
{itemRem?.elements?.map((menu) => {
|
|
161
|
+
{itemRem?.elements?.map((menu: any) => {
|
|
139
162
|
switch (menu.type) {
|
|
140
163
|
case 'collapse':
|
|
141
164
|
return (
|
|
@@ -164,7 +187,7 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
|
|
|
164
187
|
));
|
|
165
188
|
|
|
166
189
|
// menu list collapse & items
|
|
167
|
-
const items = currentItem.children?.map((menu) => {
|
|
190
|
+
const items = currentItem.children?.map((menu: any) => {
|
|
168
191
|
switch (menu.type) {
|
|
169
192
|
case 'collapse':
|
|
170
193
|
return (
|
|
@@ -267,6 +290,7 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
|
|
|
267
290
|
}}
|
|
268
291
|
>
|
|
269
292
|
{({ TransitionProps }) => (
|
|
293
|
+
// @ts-ignore
|
|
270
294
|
<Transitions in={openMini} {...TransitionProps}>
|
|
271
295
|
<Paper
|
|
272
296
|
sx={{
|
|
@@ -3,12 +3,14 @@ import { Link, useLocation } from 'react-router-dom';
|
|
|
3
3
|
import { forwardRef, useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
import { Dot } from '../../@extended';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
6
|
import { useLayoutMediaState } from '../Provider';
|
|
8
7
|
import { useMenuConfig } from '../../../hooks';
|
|
9
8
|
import { useTheme } from '@mui/material/styles';
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export type NavItemProps = {
|
|
10
|
+
item: any;
|
|
11
|
+
level: number;
|
|
12
|
+
};
|
|
13
|
+
const NavItem = ({ item, level }: NavItemProps) => {
|
|
12
14
|
const theme = useTheme();
|
|
13
15
|
|
|
14
16
|
const { horizontal, downLg } = useLayoutMediaState();
|
|
@@ -20,10 +22,16 @@ const NavItem = ({ item, level }) => {
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
let listItemProps = {
|
|
25
|
+
// @ts-ignore
|
|
23
26
|
component: forwardRef((props, ref) => <Link {...props} to={item.url} target={itemTarget} ref={ref} />)
|
|
24
27
|
};
|
|
25
28
|
if (item?.external) {
|
|
26
|
-
listItemProps = {
|
|
29
|
+
listItemProps = {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
component: 'a',
|
|
32
|
+
href: item.url,
|
|
33
|
+
target: itemTarget
|
|
34
|
+
};
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
const Icon = item.icon;
|
|
@@ -234,9 +242,4 @@ const NavItem = ({ item, level }) => {
|
|
|
234
242
|
);
|
|
235
243
|
};
|
|
236
244
|
|
|
237
|
-
NavItem.propTypes = {
|
|
238
|
-
item: PropTypes.object,
|
|
239
|
-
level: PropTypes.number
|
|
240
|
-
};
|
|
241
|
-
|
|
242
245
|
export default NavItem;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Box, SxProps } from '@mui/material';
|
|
2
|
+
import { useSx } from '../../../hooks';
|
|
3
|
+
import { useLayoutDrawerState, useLayoutMediaState } from '../Provider';
|
|
4
|
+
|
|
5
|
+
export type NavListProps = {
|
|
6
|
+
sx?: SxProps;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const NavList = (props: NavListProps) => {
|
|
11
|
+
const { horizontal } = useLayoutMediaState();
|
|
12
|
+
const { open } = useLayoutDrawerState();
|
|
13
|
+
|
|
14
|
+
const sx = useSx(props, {
|
|
15
|
+
pt: open ? (horizontal ? 0 : 2) : 0,
|
|
16
|
+
'& > ul:first-of-type': { mt: 0 },
|
|
17
|
+
display: horizontal ? { xs: 'block', lg: 'flex' } : 'block'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return <Box sx={sx}>{props.children}</Box>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default NavList;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
-
import {
|
|
4
|
-
import { useMenu,
|
|
5
|
-
import {
|
|
3
|
+
import { SxProps, Typography } from '@mui/material';
|
|
4
|
+
import { useMenu, useThemeConfig } from '../../../hooks';
|
|
5
|
+
import { useLayoutMediaState } from '../Provider';
|
|
6
6
|
import { NavGroup } from './NavGroup';
|
|
7
|
+
import NavList from './NavList';
|
|
7
8
|
|
|
8
9
|
type INavigationProps = {
|
|
9
10
|
sx?: SxProps;
|
|
@@ -13,12 +14,11 @@ type IItem = { title: any; elements: any; icon: any };
|
|
|
13
14
|
|
|
14
15
|
function Navigation(props: INavigationProps) {
|
|
15
16
|
const { horizontal } = useLayoutMediaState(),
|
|
16
|
-
{ open } = useLayoutDrawerState(),
|
|
17
17
|
{ menu, isLoading } = useMenu(),
|
|
18
18
|
[selectedItems, setSelectedItems] = useState<string>(''),
|
|
19
19
|
[selectedLevel, setSelectedLevel] = useState<number>(0),
|
|
20
20
|
{ horizontalMaxItems } = useThemeConfig(),
|
|
21
|
-
lastItem = horizontal ? horizontalMaxItems :
|
|
21
|
+
lastItem = horizontal ? horizontalMaxItems : undefined;
|
|
22
22
|
|
|
23
23
|
let lastItemIndex = isLoading ? 0 : (menu ?? []).length - 1,
|
|
24
24
|
remItems: Array<IItem> = [],
|
|
@@ -34,14 +34,8 @@ function Navigation(props: INavigationProps) {
|
|
|
34
34
|
}));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const sx = useSx(props, {
|
|
38
|
-
pt: open ? (horizontal ? 0 : 2) : 0,
|
|
39
|
-
'& > ul:first-of-type': { mt: 0 },
|
|
40
|
-
display: horizontal ? { xs: 'block', lg: 'flex' } : 'block'
|
|
41
|
-
});
|
|
42
|
-
|
|
43
37
|
return (
|
|
44
|
-
<
|
|
38
|
+
<NavList {...props}>
|
|
45
39
|
{!isLoading &&
|
|
46
40
|
_.map((menu ?? []).slice(0, lastItemIndex + 1), (item) => {
|
|
47
41
|
const { type } = item;
|
|
@@ -69,7 +63,7 @@ function Navigation(props: INavigationProps) {
|
|
|
69
63
|
);
|
|
70
64
|
}
|
|
71
65
|
})}
|
|
72
|
-
</
|
|
66
|
+
</NavList>
|
|
73
67
|
);
|
|
74
68
|
}
|
|
75
69
|
|
|
@@ -141,13 +141,7 @@ const MainCard = forwardRef(
|
|
|
141
141
|
>
|
|
142
142
|
{!darkTitle && title && (
|
|
143
143
|
/** @ts-ignore */
|
|
144
|
-
<CardHeader
|
|
145
|
-
sx={headerSX}
|
|
146
|
-
titleTypographyProps={{ variant: 'subtitle1' }}
|
|
147
|
-
title={title}
|
|
148
|
-
action={secondary}
|
|
149
|
-
subheader={subheader}
|
|
150
|
-
/>
|
|
144
|
+
<CardHeader sx={headerSX} title={title} action={secondary} subheader={subheader} />
|
|
151
145
|
)}
|
|
152
146
|
{/** @ts-ignore */}
|
|
153
147
|
{darkTitle && title && <CardHeader sx={headerSX} title={<Typography variant="h4">{title}</Typography>} action={secondary} />}
|
|
@@ -6,7 +6,12 @@ import { get } from 'lodash';
|
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
7
|
import { useAppConfig, useSx } from '../../hooks';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type StyledFieldProps = {
|
|
10
|
+
theme?: any;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const StyledField = styled('div')(({ theme, fullWidth }: StyledFieldProps) => ({
|
|
10
15
|
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
11
16
|
paddingTop: theme.spacing(1),
|
|
12
17
|
paddingBottom: theme.spacing(1),
|
|
@@ -9,14 +9,6 @@ export type StyledDivProps = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export type ReferenceManyFieldProps = RaReferenceManyFieldProps & {
|
|
12
|
-
/**
|
|
13
|
-
* Default false, serve ad aggiungere un margine attorno al componente.
|
|
14
|
-
*/
|
|
15
|
-
margin?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Default false, serve ad aggiungere un bordo inferiore al componente.
|
|
18
|
-
*/
|
|
19
|
-
border?: boolean;
|
|
20
12
|
/**
|
|
21
13
|
* Default undefined, serve ad aggiungere un padding superiore al componente per consentire
|
|
22
14
|
* la visualizzazione della toolbar delle bulk action buttons.
|
|
@@ -45,59 +37,60 @@ StyledDiv.propTypes = {
|
|
|
45
37
|
const StyledRoot = styled(StyledDiv, {
|
|
46
38
|
name: 'RaApplicaReferenceManyField',
|
|
47
39
|
slot: 'root'
|
|
48
|
-
})(({ theme,
|
|
40
|
+
})(({ theme, bulkActionButtons }: StyledRootProps) => {
|
|
49
41
|
return {
|
|
50
|
-
marginLeft:
|
|
51
|
-
marginRight:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
'& .MuiToolbar-root': {
|
|
60
|
-
[theme.breakpoints.up('sm')]: {
|
|
61
|
-
marginTop: `-${theme.spacing(2)}`,
|
|
62
|
-
marginBottom: theme.spacing(margin ? 0 : 1),
|
|
63
|
-
marginLeft: theme.spacing(margin ? 1 : 2),
|
|
64
|
-
marginRight: theme.spacing(margin ? 1 : 2),
|
|
65
|
-
width: margin ? 'auto' : `calc(100% - ${theme.spacing(5)})`
|
|
42
|
+
marginLeft: `-${theme.spacing(2.5)}`,
|
|
43
|
+
marginRight: `-${theme.spacing(2.5)}`,
|
|
44
|
+
// Access first child of the root div and align it to center
|
|
45
|
+
// This "should" be the toolbar before the datagrid (remember: should be...).
|
|
46
|
+
'&>div:first-of-type': {
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
'& form': {
|
|
49
|
+
padding: theme.spacing(2.5)
|
|
66
50
|
},
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
'& .MuiToolbar-root': {
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
padding: '0 !important',
|
|
54
|
+
marginTop: theme.spacing(1),
|
|
55
|
+
|
|
56
|
+
[theme.breakpoints.up('sm')]: {
|
|
57
|
+
marginLeft: theme.spacing(2),
|
|
58
|
+
marginRight: theme.spacing(2),
|
|
59
|
+
width: `calc(100% - ${theme.spacing(4)})`
|
|
60
|
+
},
|
|
61
|
+
[theme.breakpoints.down('md')]: {
|
|
62
|
+
marginTop: 0,
|
|
63
|
+
display: 'none',
|
|
64
|
+
visibility: 'hidden'
|
|
65
|
+
}
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
68
|
'& .RaDatagrid-root': {
|
|
72
69
|
overflowX: 'auto',
|
|
73
70
|
paddingTop: bulkActionButtons === false ? 0 : 48,
|
|
74
71
|
[theme.breakpoints.down('sm')]: {
|
|
75
|
-
width: 'calc(100vw -
|
|
72
|
+
width: 'calc(100vw - 26px)'
|
|
73
|
+
},
|
|
74
|
+
'& .RaBulkActionsToolbar-toolbar': {
|
|
75
|
+
borderRadius: 0,
|
|
76
|
+
'& > .RaBulkActionsToolbar-title': {
|
|
77
|
+
alignItems: 'center'
|
|
78
|
+
},
|
|
79
|
+
[theme.breakpoints.down('sm')]: {
|
|
80
|
+
paddingLeft: theme.spacing(3)
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
'& .RaDatagrid-table': {
|
|
84
|
+
borderBottom: `1px solid ${theme.palette.divider}`
|
|
76
85
|
}
|
|
77
86
|
},
|
|
78
|
-
|
|
79
|
-
borderBottom: `1px solid ${theme.palette.divider}`
|
|
80
|
-
},
|
|
87
|
+
|
|
81
88
|
'& .MuiTablePagination-toolbar': {
|
|
82
|
-
marginTop:
|
|
83
|
-
marginBottom: 0
|
|
89
|
+
marginTop: '0 !important',
|
|
90
|
+
marginBottom: '0 !important'
|
|
84
91
|
},
|
|
85
92
|
'& .RaBulkActionsToolbar-collapsed.RaBulkActionsToolbar-toolbar': {
|
|
86
93
|
minHeight: 0
|
|
87
|
-
},
|
|
88
|
-
'& .RaBulkActionsToolbar-toolbar': {
|
|
89
|
-
minHeight: 48,
|
|
90
|
-
bottom: -56,
|
|
91
|
-
'& h6': {
|
|
92
|
-
marginTop: theme.spacing(0.5)
|
|
93
|
-
},
|
|
94
|
-
'& .RaBulkActionsToolbar-topToolbar': {
|
|
95
|
-
marginTop: theme.spacing(1)
|
|
96
|
-
},
|
|
97
|
-
[theme.breakpoints.down('sm')]: {
|
|
98
|
-
bottom: -48,
|
|
99
|
-
borderRadius: 0
|
|
100
|
-
}
|
|
101
94
|
}
|
|
102
95
|
};
|
|
103
96
|
});
|
|
@@ -131,15 +124,4 @@ const ReferenceManyField = (props: ReferenceManyFieldProps) => (
|
|
|
131
124
|
</StyledRoot>
|
|
132
125
|
);
|
|
133
126
|
|
|
134
|
-
ReferenceManyField.defaultProps = {
|
|
135
|
-
margin: false,
|
|
136
|
-
border: false
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
ReferenceManyField.propTypes = {
|
|
140
|
-
...RaReferenceManyField.propTypes,
|
|
141
|
-
margin: PropTypes.bool,
|
|
142
|
-
border: PropTypes.bool
|
|
143
|
-
};
|
|
144
|
-
|
|
145
127
|
export default ReferenceManyField;
|
|
@@ -78,6 +78,9 @@ const StyledCreate = styled(Create, {
|
|
|
78
78
|
'& .RaCreate-card, & > div > div > form': {
|
|
79
79
|
backgroundColor: theme.palette.background.default
|
|
80
80
|
},
|
|
81
|
+
'& .RaCreate-main': {
|
|
82
|
+
marginTop: 0
|
|
83
|
+
},
|
|
81
84
|
'& .RaCreate-main>.MuiPaper-root:first-of-type': {
|
|
82
85
|
backgroundColor: theme.palette.background.default
|
|
83
86
|
},
|
|
@@ -88,8 +91,8 @@ const StyledCreate = styled(Create, {
|
|
|
88
91
|
overflow: 'visible'
|
|
89
92
|
},
|
|
90
93
|
'& .RaCreate-main:has(.tabbed-form) .MuiTableContainer-root': {
|
|
91
|
-
width: 'inherit'
|
|
92
|
-
}
|
|
94
|
+
width: 'inherit'
|
|
95
|
+
}
|
|
93
96
|
}));
|
|
94
97
|
|
|
95
98
|
export default StyledCreate;
|
|
@@ -20,6 +20,9 @@ const StyledEdit = styled(RaEdit, {
|
|
|
20
20
|
'& .RaToolbar-mobileToolbar': {
|
|
21
21
|
borderTop: `1px solid ${theme.palette.divider}`
|
|
22
22
|
},
|
|
23
|
+
'& .RaEdit-main': {
|
|
24
|
+
marginTop: 0
|
|
25
|
+
},
|
|
23
26
|
'& .RaEdit-main>.MuiPaper-root:first-of-type': {
|
|
24
27
|
backgroundColor: theme.palette.background.default
|
|
25
28
|
},
|
|
@@ -6,7 +6,7 @@ import { styled } from '@mui/material/styles';
|
|
|
6
6
|
import { useTranslate } from 'react-admin';
|
|
7
7
|
|
|
8
8
|
const StyledCardHeader = styled(CardHeader)(({ theme }) => ({
|
|
9
|
-
marginTop: theme.spacing(
|
|
9
|
+
marginTop: theme.spacing(2.5),
|
|
10
10
|
marginLeft: 0,
|
|
11
11
|
marginRight: 0,
|
|
12
12
|
paddingLeft: 0,
|
|
@@ -57,7 +57,7 @@ FormHeader.propTypes = {
|
|
|
57
57
|
|
|
58
58
|
FormHeader.defaultProps = {
|
|
59
59
|
divider: true,
|
|
60
|
-
variant: '
|
|
60
|
+
variant: 'h5'
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
export default FormHeader;
|