@hitachivantara/app-shell-ui 2.3.2 → 2.3.3
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/AppShell/AppShell.js +16 -5
- package/dist/components/AppShell/AppShellContainer.js +75 -66
- package/dist/components/AppShell/AppShellRouter.js +98 -109
- package/dist/components/AppShellI18nProvider/AppShellI18nProvider.js +19 -25
- package/dist/components/AppShellProvider/AppShellProvider.js +84 -91
- package/dist/components/AppShellViewProvider/AppShellViewProvider.js +10 -7
- package/dist/components/ConfigIcon.js +13 -15
- package/dist/components/CustomHooksInitializer/CustomHooksInitializer.js +7 -7
- package/dist/components/GlobalStyles.js +11 -9
- package/dist/components/IconUiKit/IconUiKit.js +10 -8
- package/dist/components/InitErrorFallback/InitErrorFallback.js +31 -23
- package/dist/components/SnackbarProvider/SnackbarProvider.js +17 -20
- package/dist/components/layout/AppShellLayout.js +50 -65
- package/dist/components/layout/BrandLogo/BrandLogo.js +25 -35
- package/dist/components/layout/BrandLogo/logos.js +38 -55
- package/dist/components/layout/Header/Header.js +55 -74
- package/dist/components/layout/HeaderActions/AppSwitcherToggle/AppSwitcherToggle.js +66 -74
- package/dist/components/layout/HeaderActions/AppSwitcherToggle/styles.js +12 -12
- package/dist/components/layout/HeaderActions/ColorModeSwitcher.js +23 -26
- package/dist/components/layout/HeaderActions/DynamicAction.js +22 -21
- package/dist/components/layout/HeaderActions/HeaderActions.js +15 -22
- package/dist/components/layout/HeaderActions/HelpButton/HelpButton.js +22 -31
- package/dist/components/layout/HeaderActions/InternalAction/InternalAction.js +25 -36
- package/dist/components/layout/VerticalNavigation/NavigationCollapse.js +29 -34
- package/dist/components/layout/VerticalNavigation/NavigationHeader.js +18 -20
- package/dist/components/layout/VerticalNavigation/VerticalNavigation.js +96 -130
- package/dist/hooks/useClearLocationState.js +10 -12
- package/dist/hooks/useConditionsEvaluator.js +67 -81
- package/dist/hooks/useCustomEventListener.js +16 -28
- package/dist/hooks/useFilteredModel.js +30 -27
- package/dist/hooks/useLocalStorage.js +26 -26
- package/dist/hooks/useModelFromConfig.js +43 -39
- package/dist/hooks/useNavigationMenuItems.js +27 -30
- package/dist/hooks/useNotificationsEventListener.js +35 -42
- package/dist/hooks/useResizeObserver.js +13 -13
- package/dist/hooks/useThemeEventListener.js +17 -18
- package/dist/i18n/constants.js +5 -6
- package/dist/i18n/index.js +26 -20
- package/dist/i18n/useI18nInit.js +72 -66
- package/dist/index.js +4 -3
- package/dist/pages/ErrorPage/ErrorPage.js +33 -32
- package/dist/pages/ErrorPage/Footer.js +46 -55
- package/dist/pages/GenericError/CatServer.js +585 -569
- package/dist/pages/GenericError/GenericError.js +25 -26
- package/dist/pages/LoadingPage/LoadingPage.js +9 -17
- package/dist/pages/LoadingPage/index.js +4 -3
- package/dist/pages/NotFound/DogeSpace.js +505 -540
- package/dist/pages/NotFound/NotFound.js +17 -20
- package/dist/pages/NotFound/index.js +2 -4
- package/dist/pages/RootRoute.js +32 -19
- package/dist/providers/BannerProvider.js +98 -123
- package/dist/providers/LayoutProvider.js +26 -32
- package/dist/providers/NavigationProvider.js +96 -107
- package/dist/utils/CombinedProviders.js +12 -18
- package/dist/utils/documentUtil.js +12 -12
- package/dist/utils/filterModel.js +134 -170
- package/dist/utils/lazyImport.js +31 -36
- package/dist/utils/navigationUtil.js +68 -53
- package/dist/utils/processConfig.js +119 -153
- package/package.json +8 -8
- package/dist/components/IconUiKit/index.js +0 -6
- package/dist/pages/LoadingPage/styles.js +0 -30
|
@@ -1,78 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Helmet } from "react-helmet-async";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { useHvNavigation } from "@hitachivantara/app-shell-navigation";
|
|
5
|
-
import { useHvAppShellRuntimeContext, CONFIG_TRANSLATIONS_NAMESPACE, useHvAppShellModel } from "@hitachivantara/app-shell-shared";
|
|
6
|
-
import { useTheme, HvHeader, HvButton, HvHeaderBrand, HvHeaderNavigation } from "@hitachivantara/uikit-react-core";
|
|
1
|
+
import IconUiKit_default from "../../IconUiKit/IconUiKit.js";
|
|
7
2
|
import { useNavigationContext } from "../../../providers/NavigationProvider.js";
|
|
8
|
-
import IconUiKit from "../../IconUiKit/index.js";
|
|
9
3
|
import { BrandLogo } from "../BrandLogo/BrandLogo.js";
|
|
10
4
|
import HeaderActions from "../HeaderActions/HeaderActions.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
),
|
|
64
|
-
showNavigation && /* @__PURE__ */ jsx(
|
|
65
|
-
HvHeaderNavigation,
|
|
66
|
-
{
|
|
67
|
-
data: items,
|
|
68
|
-
selected: isOnlyTopMode ? selectedMenuItemId : rootMenuItemId,
|
|
69
|
-
onClick: handleNavigationChange,
|
|
70
|
-
levels: isOnlyTopMode ? 2 : 1
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ jsx(HeaderActions, {})
|
|
74
|
-
] });
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
Header
|
|
5
|
+
import { Helmet } from "react-helmet-async";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { HvButton, HvHeader, HvHeaderBrand, HvHeaderNavigation, useTheme } from "@hitachivantara/uikit-react-core";
|
|
8
|
+
import { CONFIG_TRANSLATIONS_NAMESPACE, useHvAppShellModel, useHvAppShellRuntimeContext } from "@hitachivantara/app-shell-shared";
|
|
9
|
+
import { useHvNavigation } from "@hitachivantara/app-shell-navigation";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/layout/Header/Header.tsx
|
|
12
|
+
var Header = () => {
|
|
13
|
+
const { i18n } = useHvAppShellRuntimeContext();
|
|
14
|
+
const { t } = useTranslation(void 0, {
|
|
15
|
+
i18n,
|
|
16
|
+
keyPrefix: "header.navigation"
|
|
17
|
+
});
|
|
18
|
+
const { t: tConfig } = useTranslation(CONFIG_TRANSLATIONS_NAMESPACE, { i18n });
|
|
19
|
+
const { navigationMode, name, logo } = useHvAppShellModel();
|
|
20
|
+
const { activeTheme } = useTheme();
|
|
21
|
+
const { navigate } = useHvNavigation();
|
|
22
|
+
const { items, selectedMenuItemId, rootMenuItemId, isCompactMode, switchVerticalNavigationMode, verticalNavigationMode, verticalNavigationItems } = useNavigationContext();
|
|
23
|
+
const isOnlyTopMode = navigationMode === "ONLY_TOP";
|
|
24
|
+
const showNavigation = !isCompactMode && navigationMode !== "ONLY_LEFT" && items.length > 0;
|
|
25
|
+
const isVerticalNavigationClosed = verticalNavigationMode === "CLOSED";
|
|
26
|
+
const showVerticalNavigationButton = isCompactMode && verticalNavigationItems.length > 0;
|
|
27
|
+
const handleNavigationChange = (event, selectedItem) => {
|
|
28
|
+
if (selectedItem.href) navigate(selectedItem.href, { state: { selectedItemId: selectedItem.id } });
|
|
29
|
+
};
|
|
30
|
+
const isPentahoTheme = activeTheme?.name === "pentahoPlus";
|
|
31
|
+
const appName = name ? tConfig(name) : "";
|
|
32
|
+
return /* @__PURE__ */ jsxs(HvHeader, {
|
|
33
|
+
position: "relative",
|
|
34
|
+
style: { gridArea: "header" },
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Helmet, { children: /* @__PURE__ */ jsx("title", { children: appName }) }),
|
|
37
|
+
showVerticalNavigationButton && /* @__PURE__ */ jsx(HvButton, {
|
|
38
|
+
icon: true,
|
|
39
|
+
"aria-label": isVerticalNavigationClosed ? t("openNavigationPanel") : t("closeNavigationPanel"),
|
|
40
|
+
"aria-expanded": !isVerticalNavigationClosed,
|
|
41
|
+
onClick: switchVerticalNavigationMode,
|
|
42
|
+
children: /* @__PURE__ */ jsx(IconUiKit_default, { name: isVerticalNavigationClosed ? "Menu" : "Close" })
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx(HvHeaderBrand, {
|
|
45
|
+
logo: isPentahoTheme ? void 0 : /* @__PURE__ */ jsx(BrandLogo, { logo }),
|
|
46
|
+
name: appName
|
|
47
|
+
}),
|
|
48
|
+
showNavigation && /* @__PURE__ */ jsx(HvHeaderNavigation, {
|
|
49
|
+
data: items,
|
|
50
|
+
selected: isOnlyTopMode ? selectedMenuItemId : rootMenuItemId,
|
|
51
|
+
onClick: handleNavigationChange,
|
|
52
|
+
levels: isOnlyTopMode ? 2 : 1
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx(HeaderActions, {})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
78
57
|
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Header };
|
|
@@ -1,78 +1,70 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useId, useMemo } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
6
|
-
import { useHvAppShellRuntimeContext, CONFIG_TRANSLATIONS_NAMESPACE, useHvAppShellModel } from "@hitachivantara/app-shell-shared";
|
|
7
|
-
import { HvIconButton, theme, HvAppSwitcher, HvTypography } from "@hitachivantara/uikit-react-core";
|
|
8
|
-
import { AppSwitcher } from "@hitachivantara/uikit-react-icons";
|
|
9
|
-
import createAppContainerElement from "../../../../utils/documentUtil.js";
|
|
10
1
|
import { ConfigIcon } from "../../../ConfigIcon.js";
|
|
11
2
|
import { BrandLogo } from "../../BrandLogo/BrandLogo.js";
|
|
3
|
+
import createAppContainerElement from "../../../../utils/documentUtil.js";
|
|
12
4
|
import StyledAppShellPanelWrapper from "./styles.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
AppSwitcherToggle as default
|
|
5
|
+
import { useId, useMemo, useState } from "react";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { HvAppSwitcher, HvIconButton, HvTypography, theme } from "@hitachivantara/uikit-react-core";
|
|
8
|
+
import { CONFIG_TRANSLATIONS_NAMESPACE, useHvAppShellModel, useHvAppShellRuntimeContext } from "@hitachivantara/app-shell-shared";
|
|
9
|
+
import { AppSwitcher } from "@hitachivantara/uikit-react-icons";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
12
|
+
import { createPortal } from "react-dom";
|
|
13
|
+
//#region src/components/layout/HeaderActions/AppSwitcherToggle/AppSwitcherToggle.tsx
|
|
14
|
+
var AppSwitcherToggle = ({ title, apps, showLogo = false }) => {
|
|
15
|
+
const { i18n } = useHvAppShellRuntimeContext();
|
|
16
|
+
const { t } = useTranslation(void 0, {
|
|
17
|
+
i18n,
|
|
18
|
+
keyPrefix: "header.appSwitcher"
|
|
19
|
+
});
|
|
20
|
+
const { t: tConfig } = useTranslation(CONFIG_TRANSLATIONS_NAMESPACE, { i18n });
|
|
21
|
+
const [isPanelOpen, setIsPanelOpen] = useState(false);
|
|
22
|
+
const appSwitcherPanelId = useId();
|
|
23
|
+
const { logo } = useHvAppShellModel();
|
|
24
|
+
/** Creates the apps list to be sent to the HvAppSwitcherPanel. */
|
|
25
|
+
const appsList = useMemo(() => {
|
|
26
|
+
if (!apps) return [];
|
|
27
|
+
return apps.map((app) => ({
|
|
28
|
+
name: tConfig(app.label),
|
|
29
|
+
description: app.description ? tConfig(app.description).toString() : void 0,
|
|
30
|
+
url: app.url?.includes(":") ? app.url : tConfig(app.url).toString(),
|
|
31
|
+
target: app.target === "NEW" ? "_blank" : "_top",
|
|
32
|
+
iconElement: app.icon && /* @__PURE__ */ jsx(ConfigIcon, { icon: app.icon })
|
|
33
|
+
}));
|
|
34
|
+
}, [apps, tConfig]);
|
|
35
|
+
if (!apps || apps.length === 0) return null;
|
|
36
|
+
const finalTitle = title ? tConfig(title) : t("title");
|
|
37
|
+
return /* @__PURE__ */ jsx(ClickAwayListener, {
|
|
38
|
+
onClickAway: () => setIsPanelOpen(false),
|
|
39
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
40
|
+
style: {
|
|
41
|
+
display: "flex",
|
|
42
|
+
margin: 0
|
|
43
|
+
},
|
|
44
|
+
children: [/* @__PURE__ */ jsxs(HvIconButton, {
|
|
45
|
+
title: finalTitle,
|
|
46
|
+
"aria-expanded": isPanelOpen,
|
|
47
|
+
onClick: () => setIsPanelOpen(!isPanelOpen),
|
|
48
|
+
...isPanelOpen && { "aria-controls": appSwitcherPanelId },
|
|
49
|
+
children: [/* @__PURE__ */ jsx(AppSwitcher, {}), showLogo && /* @__PURE__ */ jsx(BrandLogo, {
|
|
50
|
+
logo,
|
|
51
|
+
style: { paddingRight: theme.space.xs }
|
|
52
|
+
})]
|
|
53
|
+
}), isPanelOpen && createPortal(/* @__PURE__ */ jsx(StyledAppShellPanelWrapper, {
|
|
54
|
+
id: appSwitcherPanelId,
|
|
55
|
+
role: "region",
|
|
56
|
+
"aria-label": t("ariaLabel"),
|
|
57
|
+
children: /* @__PURE__ */ jsx(HvAppSwitcher, {
|
|
58
|
+
applications: appsList,
|
|
59
|
+
onActionClickedCallback: () => setIsPanelOpen(false),
|
|
60
|
+
header: /* @__PURE__ */ jsx(HvTypography, {
|
|
61
|
+
variant: "label",
|
|
62
|
+
children: finalTitle
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
}), createAppContainerElement())]
|
|
66
|
+
})
|
|
67
|
+
});
|
|
78
68
|
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { AppSwitcherToggle as default };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import styled from "@emotion/styled";
|
|
2
1
|
import { theme } from "@hitachivantara/uikit-react-core";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
//#region src/components/layout/HeaderActions/AppSwitcherToggle/styles.ts
|
|
4
|
+
var StyledAppShellPanelWrapper = styled("div")({
|
|
5
|
+
position: "fixed",
|
|
6
|
+
maxHeight: `calc(100vh - ${theme.header.height})`,
|
|
7
|
+
top: theme.header.height,
|
|
8
|
+
right: 0,
|
|
9
|
+
display: "flex",
|
|
10
|
+
boxShadow: theme.colors.shadow,
|
|
11
|
+
zIndex: `calc(${theme.zIndices.banner} - 1)`
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { StyledAppShellPanelWrapper as default };
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import IconUiKit_default from "../../IconUiKit/IconUiKit.js";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import {
|
|
3
|
+
import { HvIconButton, useTheme } from "@hitachivantara/uikit-react-core";
|
|
4
4
|
import { useHvAppShellRuntimeContext } from "@hitachivantara/app-shell-shared";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
return colorModes.length > 1 ? /* @__PURE__ */ jsx(HvIconButton, { onClick: changeColorModeHandler, title: t("ariaLabel"), children: /* @__PURE__ */ jsx(IconUiKit, { name: "ThemeSwitcher" }) }) : null;
|
|
26
|
-
};
|
|
27
|
-
export {
|
|
28
|
-
ColorModeSwitcher as default
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { HvAppShellEventThemeTrigger } from "@hitachivantara/app-shell-events";
|
|
7
|
+
//#region src/components/layout/HeaderActions/ColorModeSwitcher.tsx
|
|
8
|
+
var ColorModeSwitcher = () => {
|
|
9
|
+
const { i18n } = useHvAppShellRuntimeContext();
|
|
10
|
+
const { t } = useTranslation(void 0, {
|
|
11
|
+
i18n,
|
|
12
|
+
keyPrefix: "header.colorModeSwitcher"
|
|
13
|
+
});
|
|
14
|
+
const { colorModes } = useTheme();
|
|
15
|
+
const changeColorModeHandler = () => {
|
|
16
|
+
const customEvent = new CustomEvent(HvAppShellEventThemeTrigger, { detail: { colorMode: void 0 } });
|
|
17
|
+
globalThis.dispatchEvent(customEvent);
|
|
18
|
+
};
|
|
19
|
+
return colorModes.length > 1 ? /* @__PURE__ */ jsx(HvIconButton, {
|
|
20
|
+
onClick: changeColorModeHandler,
|
|
21
|
+
title: t("ariaLabel"),
|
|
22
|
+
children: /* @__PURE__ */ jsx(IconUiKit_default, { name: "ThemeSwitcher" })
|
|
23
|
+
}) : null;
|
|
29
24
|
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ColorModeSwitcher as default };
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
import { Suspense, lazy, memo, useEffect, useState } from "react";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
const DynamicAction$1 = memo(DynamicAction);
|
|
21
|
-
export {
|
|
22
|
-
DynamicAction$1 as default
|
|
3
|
+
//#region src/components/layout/HeaderActions/DynamicAction.tsx
|
|
4
|
+
var DynamicAction = ({ bundle, ...others }) => {
|
|
5
|
+
const [loadError, setLoadError] = useState(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
setLoadError(null);
|
|
8
|
+
}, [bundle]);
|
|
9
|
+
const Action = lazy(() => import(
|
|
10
|
+
/* @vite-ignore */
|
|
11
|
+
bundle
|
|
12
|
+
).catch((error) => {
|
|
13
|
+
console.error(error);
|
|
14
|
+
setLoadError(error);
|
|
15
|
+
return { default: () => null };
|
|
16
|
+
}));
|
|
17
|
+
return /* @__PURE__ */ jsx(Suspense, {
|
|
18
|
+
fallback: null,
|
|
19
|
+
children: !loadError && /* @__PURE__ */ jsx(Action, { ...others })
|
|
20
|
+
});
|
|
23
21
|
};
|
|
22
|
+
var DynamicAction_default = memo(DynamicAction);
|
|
23
|
+
//#endregion
|
|
24
|
+
export { DynamicAction_default as default };
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import DynamicAction_default from "./DynamicAction.js";
|
|
2
|
+
import InternalAction_default, { internalActions } from "./InternalAction/InternalAction.js";
|
|
3
3
|
import { HvHeaderActions } from "@hitachivantara/uikit-react-core";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
bundle: action.bundle,
|
|
16
|
-
...action.config
|
|
17
|
-
},
|
|
18
|
-
action.key
|
|
19
|
-
);
|
|
20
|
-
}) });
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
HeaderActions as default
|
|
4
|
+
import { useHvAppShellModel } from "@hitachivantara/app-shell-shared";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/layout/HeaderActions/HeaderActions.tsx
|
|
7
|
+
var HeaderActions = () => {
|
|
8
|
+
const { header } = useHvAppShellModel();
|
|
9
|
+
return /* @__PURE__ */ jsx(HvHeaderActions, { children: header?.actions.map((action) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(internalActions.some((a) => a.bundle === action.bundle) ? InternalAction_default : DynamicAction_default, {
|
|
11
|
+
bundle: action.bundle,
|
|
12
|
+
...action.config
|
|
13
|
+
}, action.key);
|
|
14
|
+
}) });
|
|
24
15
|
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { HeaderActions as default };
|
|
@@ -1,34 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import IconUiKit_default from "../../../IconUiKit/IconUiKit.js";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useHvAppShellRuntimeContext, CONFIG_TRANSLATIONS_NAMESPACE } from "@hitachivantara/app-shell-shared";
|
|
4
3
|
import { HvIconButton } from "@hitachivantara/uikit-react-core";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
href: finalUrl,
|
|
25
|
-
target: "_blank",
|
|
26
|
-
title: finalDescription,
|
|
27
|
-
rel: "noopener,noreferrer",
|
|
28
|
-
children: /* @__PURE__ */ jsx(IconUiKit, { name: "Help" })
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
HelpButton as default
|
|
4
|
+
import { CONFIG_TRANSLATIONS_NAMESPACE, useHvAppShellRuntimeContext } from "@hitachivantara/app-shell-shared";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/layout/HeaderActions/HelpButton/HelpButton.tsx
|
|
7
|
+
var HelpButton = ({ url, description }) => {
|
|
8
|
+
const { i18n } = useHvAppShellRuntimeContext();
|
|
9
|
+
const { t } = useTranslation(void 0, {
|
|
10
|
+
i18n,
|
|
11
|
+
keyPrefix: "header.helpUrl"
|
|
12
|
+
});
|
|
13
|
+
const { t: tConfig } = useTranslation(CONFIG_TRANSLATIONS_NAMESPACE, { i18n });
|
|
14
|
+
if (!url) return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(HvIconButton, {
|
|
16
|
+
component: "a",
|
|
17
|
+
href: url.includes(":") ? url : tConfig(url),
|
|
18
|
+
target: "_blank",
|
|
19
|
+
title: description ? tConfig(description) : t("documentationLink"),
|
|
20
|
+
rel: "noopener,noreferrer",
|
|
21
|
+
children: /* @__PURE__ */ jsx(IconUiKit_default, { name: "Help" })
|
|
22
|
+
});
|
|
34
23
|
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { HelpButton as default };
|
|
@@ -1,39 +1,28 @@
|
|
|
1
|
+
import { Suspense, lazy, memo } from "react";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
bundle: "@hv/app-switcher-client/toggle.js",
|
|
18
|
-
component: () => import("../AppSwitcherToggle/AppSwitcherToggle.js").then((module) => ({
|
|
19
|
-
default: module.default
|
|
20
|
-
}))
|
|
21
|
-
}
|
|
3
|
+
//#region src/components/layout/HeaderActions/InternalAction/InternalAction.tsx
|
|
4
|
+
var internalActions = [
|
|
5
|
+
{
|
|
6
|
+
bundle: "@hv/theming-client/colorModeSwitcher.js",
|
|
7
|
+
component: () => import("../ColorModeSwitcher.js").then((module) => ({ default: module.default }))
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
bundle: "@hv/help-client/button.js",
|
|
11
|
+
component: () => import("../HelpButton/HelpButton.js").then((module) => ({ default: module.default }))
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
bundle: "@hv/app-switcher-client/toggle.js",
|
|
15
|
+
component: () => import("../AppSwitcherToggle/AppSwitcherToggle.js").then((module) => ({ default: module.default }))
|
|
16
|
+
}
|
|
22
17
|
];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const Action = lazy(
|
|
31
|
-
() => component()
|
|
32
|
-
);
|
|
33
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Action, { ...others }) });
|
|
34
|
-
};
|
|
35
|
-
const InternalAction$1 = memo(InternalAction);
|
|
36
|
-
export {
|
|
37
|
-
InternalAction$1 as default,
|
|
38
|
-
internalActions
|
|
18
|
+
var InternalAction = ({ bundle, ...others }) => {
|
|
19
|
+
const { component } = internalActions.find((internalAction) => internalAction.bundle === bundle) ?? {};
|
|
20
|
+
if (!component) return null;
|
|
21
|
+
return /* @__PURE__ */ jsx(Suspense, {
|
|
22
|
+
fallback: null,
|
|
23
|
+
children: /* @__PURE__ */ jsx(lazy(() => component()), { ...others })
|
|
24
|
+
});
|
|
39
25
|
};
|
|
26
|
+
var InternalAction_default = memo(InternalAction);
|
|
27
|
+
//#endregion
|
|
28
|
+
export { InternalAction_default as default, internalActions };
|