@deix/rossini-core 2.1.8 → 2.2.0
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/lib/components/layout/StandardLayout/StandardLayout.d.ts +4 -0
- package/lib/components/layout/StandardLayout/StandardLayout.d.ts.map +1 -1
- package/lib/components/layout/StandardLayout/StandardLayout.js +4 -7
- package/lib/components/layout/components/Topbar/Topbar.d.ts +5 -1
- package/lib/components/layout/components/Topbar/Topbar.d.ts.map +1 -1
- package/lib/components/layout/components/Topbar/Topbar.js +2 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -41,6 +41,10 @@ interface StandardLayoutProps {
|
|
|
41
41
|
* List of language options
|
|
42
42
|
*/
|
|
43
43
|
languages?: Language[];
|
|
44
|
+
/**
|
|
45
|
+
* List of React nodes to be rendered in the Topbar
|
|
46
|
+
*/
|
|
47
|
+
topbarActions?: ReactNode[];
|
|
44
48
|
}
|
|
45
49
|
declare const StandardLayout: React.FC<StandardLayoutProps>;
|
|
46
50
|
export default StandardLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/StandardLayout/StandardLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQzC,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAe,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIrE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"StandardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/StandardLayout/StandardLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQzC,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAe,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIrE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI1D,UAAU,mBAAmB;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;CAC7B;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAkHjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -10,7 +10,8 @@ import TopLine from '../components/Topline/TopLine';
|
|
|
10
10
|
import { useLocale, usePersistedState } from '../../../utils';
|
|
11
11
|
import ServerDown from '../assets/ServerDown';
|
|
12
12
|
import t from './translations.json';
|
|
13
|
-
const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLinks = [], avatar, languages, children,
|
|
13
|
+
const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLinks = [], avatar, languages, children, topbarActions = [], // Aggiungi la gestione di topbarActions
|
|
14
|
+
}) => {
|
|
14
15
|
const theme = useMUITheme();
|
|
15
16
|
const locale = useLocale();
|
|
16
17
|
// Get if we are dealing with mobile client
|
|
@@ -18,7 +19,7 @@ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLin
|
|
|
18
19
|
// Persist user preference about the sidebar
|
|
19
20
|
const [sidebarOpen, setSidebarOpen] = usePersistedState('sidebarOpen', isMobile ? false : true);
|
|
20
21
|
// Don't show anything until localStorage has been read
|
|
21
|
-
if (sidebarOpen
|
|
22
|
+
if (sidebarOpen === undefined) {
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
24
25
|
return (React.createElement(Box, { sx: { display: 'flex', flexDirection: 'row' } },
|
|
@@ -32,13 +33,10 @@ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLin
|
|
|
32
33
|
background: theme.palette.background.default,
|
|
33
34
|
} },
|
|
34
35
|
React.createElement(TopLine, null),
|
|
35
|
-
React.createElement(Topbar, { hasSidebar: sidebarLinks && sidebarLinks.length > 0, onSidebarClose: () => setSidebarOpen(false), onSidebarOpen: () => setSidebarOpen(true), open: sidebarOpen, locale: locale, languages: languages, avatar: avatar }),
|
|
36
|
+
React.createElement(Topbar, { hasSidebar: sidebarLinks && sidebarLinks.length > 0, onSidebarClose: () => setSidebarOpen(false), onSidebarOpen: () => setSidebarOpen(true), open: sidebarOpen, locale: locale, languages: languages, avatar: avatar, additionalNodes: topbarActions }),
|
|
36
37
|
isLoading && React.createElement(CircularLoading, { locale: locale }),
|
|
37
38
|
!isLoading && isError && (React.createElement(Box, { sx: {
|
|
38
39
|
flexGrow: 1,
|
|
39
|
-
// display: 'flex',
|
|
40
|
-
// flexDirection: 'column',
|
|
41
|
-
// height: '100%',
|
|
42
40
|
maxWidth: '100%',
|
|
43
41
|
overflowX: 'hidden',
|
|
44
42
|
paddingTop: 2,
|
|
@@ -59,7 +57,6 @@ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLin
|
|
|
59
57
|
"Error: ",
|
|
60
58
|
error.message))))),
|
|
61
59
|
!isLoading && (React.createElement(Box, { sx: {
|
|
62
|
-
// flexGrow: 1,
|
|
63
60
|
maxWidth: '100%',
|
|
64
61
|
overflowX: 'hidden',
|
|
65
62
|
paddingTop: 2,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { Language, Locale } from '../../../../types/languages';
|
|
3
3
|
import { AvatarProps } from '../../../buttons/Avatar/Avatar';
|
|
4
4
|
interface TopbarProps {
|
|
@@ -30,6 +30,10 @@ interface TopbarProps {
|
|
|
30
30
|
* The props to be passed to the Avatar button component.
|
|
31
31
|
*/
|
|
32
32
|
avatar?: AvatarProps;
|
|
33
|
+
/**
|
|
34
|
+
* Array of React nodes to display dynamically in the topbar.
|
|
35
|
+
*/
|
|
36
|
+
additionalNodes?: ReactNode[];
|
|
33
37
|
backgroundColor?: string;
|
|
34
38
|
iconsColor?: string;
|
|
35
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Topbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Topbar/Topbar.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Topbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Topbar/Topbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAcrD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAU,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAKrE,UAAU,WAAW;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA2EjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -10,7 +10,7 @@ import ElevationScroll from './ElevationScroll';
|
|
|
10
10
|
import t from './translations.json';
|
|
11
11
|
import { ThemeModeContext } from '../../../provider/ThemeProvider';
|
|
12
12
|
const Topbar = (props) => {
|
|
13
|
-
const { hasSidebar = false, onSidebarClose, onSidebarOpen, open, locale, languages, avatar, } = props;
|
|
13
|
+
const { hasSidebar = false, onSidebarClose, onSidebarOpen, open, locale, languages, avatar, additionalNodes = [], } = props;
|
|
14
14
|
const { themeMode, setThemeMode } = useContext(ThemeModeContext);
|
|
15
15
|
const muiTheme = useMUITheme();
|
|
16
16
|
const SidebarIcon = open ? (React.createElement(MenuOpenTwoToneIcon, { htmlColor: muiTheme.palette.topbar.contrastText })) : (React.createElement(MenuTwoToneIcon, { htmlColor: muiTheme.palette.topbar.contrastText }));
|
|
@@ -26,6 +26,7 @@ const Topbar = (props) => {
|
|
|
26
26
|
hasSidebar && (React.createElement(Tooltip, { title: menuMessage, arrow: true },
|
|
27
27
|
React.createElement(IconButton, { color: 'inherit', "aria-label": 'open drawer', onClick: () => (open ? onSidebarClose() : onSidebarOpen()), edge: 'start' }, SidebarIcon))),
|
|
28
28
|
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
29
|
+
additionalNodes.map((node, index) => (React.createElement(React.Fragment, { key: index }, node))),
|
|
29
30
|
React.createElement(LanguageSelect, { locale: locale, languages: languages }),
|
|
30
31
|
React.createElement(Avatar, { ...avatar }),
|
|
31
32
|
React.createElement(Tooltip, { title: themeMode === 'light'
|