@gridsuite/commons-ui 0.140.0 → 0.142.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/dist/components/cardErrorBoundary/CardErrorBoundary.d.ts +1 -1
- package/dist/components/csvDownloader/csv-export.d.ts +1 -0
- package/dist/components/customAGGrid/cell-renderers.d.ts +26 -0
- package/dist/components/customAGGrid/cell-renderers.js +199 -0
- package/dist/components/customAGGrid/index.d.ts +1 -0
- package/dist/components/customAGGrid/index.js +9 -0
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.d.ts +1 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +3 -0
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +5 -2
- package/dist/components/directoryItemSelector/utils.js +2 -1
- package/dist/components/dnd-table/dnd-table.type.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +15 -0
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +2 -1
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -55
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +1 -0
- package/dist/components/inputs/reactQueryBuilder/ElementValueEditor.js +1 -1
- package/dist/components/muiTable/OverflowableTableCell.d.ts +3 -0
- package/dist/components/muiTable/OverflowableTableCell.js +10 -0
- package/dist/components/muiTable/OverflowableTableCellWithCheckbox.d.ts +6 -0
- package/dist/components/muiTable/OverflowableTableCellWithCheckbox.js +16 -0
- package/dist/components/muiTable/index.d.ts +8 -0
- package/dist/components/muiTable/index.js +6 -0
- package/dist/components/overflowableText/OverflowableText.js +1 -1
- package/dist/components/parameters/common/parameters-creation-dialog.js +1 -1
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/resizablePanels/ResizeHandle.d.ts +8 -0
- package/dist/components/resizablePanels/ResizeHandle.js +32 -0
- package/dist/components/resizablePanels/index.d.ts +7 -0
- package/dist/components/resizablePanels/index.js +4 -0
- package/dist/components/topBar/GridLogo.d.ts +4 -2
- package/dist/components/topBar/GridLogo.js +39 -21
- package/dist/components/topBar/TopBar.d.ts +2 -1
- package/dist/components/topBar/TopBar.js +81 -65
- package/dist/hooks/useIntlRef.d.ts +1 -1
- package/dist/hooks/usePrevious.js +1 -1
- package/dist/index.js +24 -5
- package/dist/services/appsMetadata.d.ts +2 -1
- package/dist/services/appsMetadata.js +9 -2
- package/dist/services/config.d.ts +10 -0
- package/dist/services/config.js +34 -0
- package/dist/services/directory.d.ts +6 -4
- package/dist/services/directory.js +17 -32
- package/dist/services/index.d.ts +5 -4
- package/dist/services/index.js +9 -5
- package/dist/utils/types/metadata.d.ts +14 -0
- package/package.json +8 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell } from "@mui/material";
|
|
3
|
+
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
4
|
+
function OverflowableTableCell(overflowableTextProps) {
|
|
5
|
+
return /* @__PURE__ */ jsx(TableCell, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(OverflowableText, { sx: { flex: "1 1 0", width: 0, display: "block" }, ...overflowableTextProps }) });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
OverflowableTableCell,
|
|
9
|
+
OverflowableTableCell as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OverflowableTextProps } from '../overflowableText';
|
|
2
|
+
export interface OverflowableTableCellProps extends OverflowableTextProps {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function OverflowableTableCellWithCheckbox({ checked, ...overflowableTextProps }: Readonly<OverflowableTableCellProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default OverflowableTableCellWithCheckbox;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell, Checkbox } from "@mui/material";
|
|
3
|
+
import { OverflowableText } from "../overflowableText/OverflowableText.js";
|
|
4
|
+
function OverflowableTableCellWithCheckbox({
|
|
5
|
+
checked,
|
|
6
|
+
...overflowableTextProps
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsxs(TableCell, { padding: "checkbox", sx: { display: "flex", alignItems: "center", width: "100%" }, children: [
|
|
9
|
+
/* @__PURE__ */ jsx(Checkbox, { checked }),
|
|
10
|
+
/* @__PURE__ */ jsx(OverflowableText, { sx: { flex: "1 1 0", width: 0, display: "block" }, ...overflowableTextProps })
|
|
11
|
+
] });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
OverflowableTableCellWithCheckbox,
|
|
15
|
+
OverflowableTableCellWithCheckbox as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './OverflowableTableCell';
|
|
8
|
+
export * from './OverflowableTableCellWithCheckbox';
|
|
@@ -40,7 +40,7 @@ const OverflowableText = styled(
|
|
|
40
40
|
sx,
|
|
41
41
|
...props
|
|
42
42
|
}) => {
|
|
43
|
-
const element = useRef();
|
|
43
|
+
const element = useRef(void 0);
|
|
44
44
|
const isMultiLine = useMemo(() => maxLineCount && maxLineCount > 1, [maxLineCount]);
|
|
45
45
|
const [overflowed, setOverflowed] = useState(false);
|
|
46
46
|
const checkOverflow = useCallback(() => {
|
|
@@ -2,11 +2,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import "react-intl";
|
|
4
4
|
import "../../../utils/types/equipmentType.js";
|
|
5
|
-
import { createParameter, updateParameter } from "../../../services/explore.js";
|
|
6
5
|
import "../../../utils/conversionUtils.js";
|
|
7
6
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
8
7
|
import "@mui/icons-material";
|
|
9
8
|
import "../../../utils/yupConfig.js";
|
|
9
|
+
import { createParameter, updateParameter } from "../../../services/explore.js";
|
|
10
10
|
import "@mui/material";
|
|
11
11
|
import "localized-countries";
|
|
12
12
|
import "localized-countries/data/fr";
|
|
@@ -8,12 +8,12 @@ import "react/jsx-runtime";
|
|
|
8
8
|
import "@mui/material";
|
|
9
9
|
import "react-intl";
|
|
10
10
|
import "../../../utils/types/equipmentType.js";
|
|
11
|
-
import { updateParameter } from "../../../services/explore.js";
|
|
12
11
|
import "../../../utils/conversionUtils.js";
|
|
13
12
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
14
13
|
import "@mui/icons-material";
|
|
15
14
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
16
15
|
import "../../../utils/yupConfig.js";
|
|
16
|
+
import { updateParameter } from "../../../services/explore.js";
|
|
17
17
|
import "localized-countries";
|
|
18
18
|
import "localized-countries/data/fr";
|
|
19
19
|
import "localized-countries/data/en";
|
|
@@ -7,11 +7,11 @@ import "react-intl";
|
|
|
7
7
|
import "@mui/material";
|
|
8
8
|
import "../../overflowableText/OverflowableText.js";
|
|
9
9
|
import "../../../utils/types/equipmentType.js";
|
|
10
|
-
import { updateParameter } from "../../../services/explore.js";
|
|
11
10
|
import "../../../utils/conversionUtils.js";
|
|
12
11
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
13
12
|
import "@mui/icons-material";
|
|
14
13
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
14
|
+
import { updateParameter } from "../../../services/explore.js";
|
|
15
15
|
import { setStudyNetworkVisualizationParameters } from "../../../services/study.js";
|
|
16
16
|
import { getNetworkVisualizationsParameters } from "../../../services/study-config.js";
|
|
17
17
|
import "localized-countries";
|
|
@@ -6,13 +6,13 @@ import "react/jsx-runtime";
|
|
|
6
6
|
import "@mui/material";
|
|
7
7
|
import "react-intl";
|
|
8
8
|
import "../../../utils/types/equipmentType.js";
|
|
9
|
-
import { updateParameter } from "../../../services/explore.js";
|
|
10
9
|
import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
|
|
11
10
|
import "../../../utils/conversionUtils.js";
|
|
12
11
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
13
12
|
import "@mui/icons-material";
|
|
14
13
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
15
14
|
import "../../../utils/yupConfig.js";
|
|
15
|
+
import { updateParameter } from "../../../services/explore.js";
|
|
16
16
|
import "localized-countries";
|
|
17
17
|
import "localized-countries/data/fr";
|
|
18
18
|
import "localized-countries/data/en";
|
|
@@ -7,11 +7,11 @@ import "react-intl";
|
|
|
7
7
|
import "@mui/material";
|
|
8
8
|
import "../../overflowableText/OverflowableText.js";
|
|
9
9
|
import "../../../utils/types/equipmentType.js";
|
|
10
|
-
import { updateParameter } from "../../../services/explore.js";
|
|
11
10
|
import "../../../utils/conversionUtils.js";
|
|
12
11
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
13
12
|
import "@mui/icons-material";
|
|
14
13
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
14
|
+
import { updateParameter } from "../../../services/explore.js";
|
|
15
15
|
import { setStudyShortCircuitParameters, invalidateStudyShortCircuitStatus } from "../../../services/study.js";
|
|
16
16
|
import "localized-countries";
|
|
17
17
|
import "localized-countries/data/fr";
|
|
@@ -7,12 +7,12 @@ import "react-intl";
|
|
|
7
7
|
import "@mui/material";
|
|
8
8
|
import "../../overflowableText/OverflowableText.js";
|
|
9
9
|
import "../../../utils/types/equipmentType.js";
|
|
10
|
-
import { updateParameter } from "../../../services/explore.js";
|
|
11
10
|
import { ID, FILTERS } from "../../../utils/constants/filterConstant.js";
|
|
12
11
|
import { isBlankOrEmpty } from "../../../utils/conversionUtils.js";
|
|
13
12
|
import { snackWithFallback } from "../../../utils/error.js";
|
|
14
13
|
import "@mui/icons-material";
|
|
15
14
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
15
|
+
import { updateParameter } from "../../../services/explore.js";
|
|
16
16
|
import { updateVoltageInitParameters } from "../../../services/study.js";
|
|
17
17
|
import { getVoltageInitParameters } from "../../../services/voltage-init.js";
|
|
18
18
|
import "localized-countries";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
interface ResizeHandleProps {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
rotated?: boolean;
|
|
5
|
+
style?: (theme: Theme) => React.CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
export declare function ResizeHandle({ visible, rotated, style }: Readonly<ResizeHandleProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default ResizeHandle;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PanelResizeHandle } from "react-resizable-panels";
|
|
3
|
+
import { DragIndicator } from "@mui/icons-material";
|
|
4
|
+
import { useTheme } from "@mui/material";
|
|
5
|
+
const getStyles = (theme, visible, rotated, customStyle) => ({
|
|
6
|
+
handle: {
|
|
7
|
+
display: visible ? "flex" : "none",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
backgroundColor: theme.palette.background.paper,
|
|
10
|
+
borderLeft: rotated ? "none" : `1px solid ${theme.palette.divider}`,
|
|
11
|
+
borderRight: rotated ? "none" : `1px solid ${theme.palette.divider}`,
|
|
12
|
+
borderBottom: rotated ? `1px solid ${theme.palette.divider}` : "none",
|
|
13
|
+
borderTop: rotated ? `1px solid ${theme.palette.divider}` : "none",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
...customStyle ? customStyle(theme) : {}
|
|
16
|
+
},
|
|
17
|
+
icon: {
|
|
18
|
+
transform: rotated ? "rotate(90deg)" : "none",
|
|
19
|
+
transition: "transform 0.2s",
|
|
20
|
+
color: "inherit",
|
|
21
|
+
cursor: "ns-resize"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
function ResizeHandle({ visible = true, rotated = false, style }) {
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
const styles = getStyles(theme, visible, rotated, style);
|
|
27
|
+
return /* @__PURE__ */ jsx(PanelResizeHandle, { style: styles.handle, children: /* @__PURE__ */ jsx(DragIndicator, { fontSize: "small", style: styles.icon }) });
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
ResizeHandle,
|
|
31
|
+
ResizeHandle as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
export * from './ResizeHandle';
|
|
@@ -2,12 +2,14 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { SxStyle } from '../../utils/styles';
|
|
3
3
|
export interface GridLogoProps extends Omit<LogoTextProps, 'style'> {
|
|
4
4
|
appLogo: ReactNode;
|
|
5
|
+
dense?: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare function LogoText({ appName, appColor, style, onClick }: Partial<LogoTextProps
|
|
7
|
-
export declare function GridLogo({ appLogo, appName, appColor, onClick }: Partial<GridLogoProps
|
|
7
|
+
export declare function LogoText({ appName, appColor, style, onClick, dense }: Readonly<Partial<LogoTextProps>>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function GridLogo({ appLogo, appName, appColor, onClick, dense }: Readonly<Partial<GridLogoProps>>): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export interface LogoTextProps {
|
|
9
10
|
appName: string;
|
|
10
11
|
appColor: string;
|
|
11
12
|
style: SxStyle;
|
|
12
13
|
onClick: () => void;
|
|
14
|
+
dense?: boolean;
|
|
13
15
|
}
|
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
import { jsxs, jsx
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Typography, Box } from "@mui/material";
|
|
3
3
|
import { BrokenImage } from "@mui/icons-material";
|
|
4
|
+
import { useMemo } from "react";
|
|
4
5
|
import { mergeSx } from "../../utils/styles.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
const LOGO_WIDTH = 32;
|
|
7
|
+
const LOGO_HEIGHT = 32;
|
|
8
|
+
const LOGO_WIDTH_DENSE = 26;
|
|
9
|
+
const LOGO_HEIGHT_DENSE = 26;
|
|
10
|
+
const getStyles = (dense = false) => {
|
|
11
|
+
return {
|
|
12
|
+
container: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
alignItems: "center"
|
|
15
|
+
},
|
|
16
|
+
logo: (_theme) => ({
|
|
17
|
+
flexShrink: 0,
|
|
18
|
+
width: dense ? LOGO_WIDTH_DENSE : LOGO_WIDTH,
|
|
19
|
+
height: dense ? LOGO_HEIGHT_DENSE : LOGO_HEIGHT,
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
justifyContent: "center"
|
|
23
|
+
}),
|
|
24
|
+
title: (theme) => ({
|
|
25
|
+
marginLeft: theme.spacing(dense ? 0.5 : 1),
|
|
26
|
+
display: { xs: "none", lg: "block" },
|
|
27
|
+
...dense && {
|
|
28
|
+
fontSize: 18
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
clickable: {
|
|
32
|
+
cursor: "pointer"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
19
35
|
};
|
|
20
|
-
function LogoText({ appName, appColor, style, onClick }) {
|
|
21
|
-
|
|
36
|
+
function LogoText({ appName, appColor, style, onClick, dense = false }) {
|
|
37
|
+
const styles = useMemo(() => getStyles(dense), [dense]);
|
|
38
|
+
return /* @__PURE__ */ jsxs(Typography, { sx: mergeSx(style, onClick && styles.clickable), onClick, children: [
|
|
22
39
|
/* @__PURE__ */ jsx("span", { style: { fontWeight: "bold" }, children: "Grid" }),
|
|
23
40
|
/* @__PURE__ */ jsx("span", { style: { color: appColor }, children: appName })
|
|
24
41
|
] });
|
|
25
42
|
}
|
|
26
|
-
function GridLogo({ appLogo, appName, appColor, onClick }) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/* @__PURE__ */ jsx(
|
|
43
|
+
function GridLogo({ appLogo, appName, appColor, onClick, dense = false }) {
|
|
44
|
+
const styles = useMemo(() => getStyles(dense), [dense]);
|
|
45
|
+
return /* @__PURE__ */ jsxs(Box, { sx: mergeSx(styles.container, onClick && styles.clickable), onClick, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Box, { sx: styles.logo, children: appLogo || /* @__PURE__ */ jsx(BrokenImage, {}) }),
|
|
47
|
+
/* @__PURE__ */ jsx(LogoText, { appName, appColor, style: styles.title, dense })
|
|
30
48
|
] });
|
|
31
49
|
}
|
|
32
50
|
export {
|
|
@@ -20,5 +20,6 @@ export type TopBarProps = Omit<GridLogoProps, 'onClick'> & Omit<LogoutProps, 'di
|
|
|
20
20
|
language: GsLang;
|
|
21
21
|
developerMode?: boolean;
|
|
22
22
|
onDeveloperModeClick?: (value: boolean) => void;
|
|
23
|
+
dense?: boolean;
|
|
23
24
|
};
|
|
24
|
-
export declare function TopBar({ appName, appColor, appLogo, appVersion, appLicense, logoAboutDialog, onLogoutClick, onLogoClick, user, children, appsAndUrls, onAboutClick, globalVersionPromise, additionalModulesPromise, onThemeClick, theme, developerMode, onDeveloperModeClick, onEquipmentLabellingClick, equipmentLabelling, onLanguageClick, language, }: PropsWithChildren<TopBarProps>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function TopBar({ appName, appColor, appLogo, appVersion, appLicense, logoAboutDialog, onLogoutClick, onLogoClick, user, children, appsAndUrls, onAboutClick, globalVersionPromise, additionalModulesPromise, onThemeClick, theme, developerMode, onDeveloperModeClick, onEquipmentLabellingClick, equipmentLabelling, onLanguageClick, language, dense, }: PropsWithChildren<TopBarProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
3
|
import { FormattedMessage } from "react-intl";
|
|
4
|
-
import { styled, Menu, MenuItem, ListItemIcon, AppBar, Toolbar, Box, IconButton, ListItemText, Button,
|
|
4
|
+
import { styled, Menu, MenuItem, ListItemIcon, AppBar, Toolbar, Box, IconButton, ListItemText, Button, Popper, Paper, ClickAwayListener, MenuList, Typography, ToggleButtonGroup, ToggleButton, darken } from "@mui/material";
|
|
5
5
|
import { Apps, ArrowDropUp, ArrowDropDown, Person, Badge, ManageAccounts, HelpOutline, WbSunny, Brightness3, Computer, ExitToApp } from "@mui/icons-material";
|
|
6
6
|
import { GridLogo } from "./GridLogo.js";
|
|
7
7
|
import { AboutDialog } from "./AboutDialog.js";
|
|
@@ -11,63 +11,77 @@ import UserSettingsDialog from "./UserSettingsDialog.js";
|
|
|
11
11
|
import { LIGHT_THEME, DARK_THEME } from "../../utils/styles.js";
|
|
12
12
|
import { LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH } from "../../utils/langs.js";
|
|
13
13
|
import { DevModeBanner } from "./DevModeBanner.js";
|
|
14
|
-
const
|
|
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
|
-
|
|
14
|
+
const getStyles = (dense = false) => {
|
|
15
|
+
return {
|
|
16
|
+
toolbar: (theme) => ({
|
|
17
|
+
...dense && {
|
|
18
|
+
minHeight: `${theme.spacing(6)} !important`,
|
|
19
|
+
paddingLeft: `${theme.spacing(0.875)} !important`,
|
|
20
|
+
paddingRight: `${theme.spacing(0.875)} !important`
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
grow: {
|
|
24
|
+
flexGrow: 1,
|
|
25
|
+
display: "flex",
|
|
26
|
+
overflow: "hidden"
|
|
27
|
+
},
|
|
28
|
+
menuContainer: (theme) => ({
|
|
29
|
+
marginLeft: theme.spacing(dense ? 0.5 : 1)
|
|
30
|
+
}),
|
|
31
|
+
link: {
|
|
32
|
+
textDecoration: "none",
|
|
33
|
+
color: "inherit"
|
|
34
|
+
},
|
|
35
|
+
name: (theme) => ({
|
|
36
|
+
backgroundColor: darken(theme.palette.background.paper, 0.1),
|
|
37
|
+
paddingTop: theme.spacing(dense ? 0.625 : 1.25),
|
|
38
|
+
borderRadius: "100%",
|
|
39
|
+
fontWeight: "400",
|
|
40
|
+
textTransform: "uppercase",
|
|
41
|
+
height: theme.spacing(dense ? 4.5 : 6),
|
|
42
|
+
width: theme.spacing(dense ? 4.5 : 6)
|
|
43
|
+
}),
|
|
44
|
+
arrowIcon: (theme) => ({
|
|
45
|
+
fontSize: theme.spacing(dense ? 4 : 5)
|
|
46
|
+
}),
|
|
47
|
+
userMail: {
|
|
48
|
+
fontSize: "14px",
|
|
49
|
+
display: "block"
|
|
50
|
+
},
|
|
51
|
+
borderBottom: {
|
|
52
|
+
borderBottom: "1px solid #ccc"
|
|
53
|
+
},
|
|
54
|
+
borderTop: {
|
|
55
|
+
borderTop: "1px solid #ccc"
|
|
56
|
+
},
|
|
57
|
+
settingsMenu: {
|
|
58
|
+
maxWidth: "385px",
|
|
59
|
+
zIndex: 60
|
|
60
|
+
},
|
|
61
|
+
sizeLabel: {
|
|
62
|
+
fontSize: "16px"
|
|
63
|
+
},
|
|
64
|
+
showHideMenu: (theme) => ({
|
|
65
|
+
padding: 0,
|
|
66
|
+
borderRadius: "50%",
|
|
67
|
+
minWidth: theme.spacing(dense ? 5 : 6.875),
|
|
68
|
+
minHeight: theme.spacing(dense ? 5 : 6.875)
|
|
69
|
+
}),
|
|
70
|
+
toggleButtonGroup: {
|
|
71
|
+
marginLeft: "15px",
|
|
72
|
+
pointerEvents: "auto"
|
|
73
|
+
},
|
|
74
|
+
toggleButton: {
|
|
75
|
+
height: "30px",
|
|
76
|
+
width: "48px",
|
|
77
|
+
padding: "7px",
|
|
78
|
+
textTransform: "capitalize"
|
|
79
|
+
},
|
|
80
|
+
languageToggleButton: {
|
|
81
|
+
height: "30px",
|
|
82
|
+
width: "48px"
|
|
83
|
+
}
|
|
84
|
+
};
|
|
71
85
|
};
|
|
72
86
|
const StyledMenu = styled((props) => /* @__PURE__ */ jsx(
|
|
73
87
|
Menu,
|
|
@@ -130,8 +144,10 @@ function TopBar({
|
|
|
130
144
|
onEquipmentLabellingClick,
|
|
131
145
|
equipmentLabelling,
|
|
132
146
|
onLanguageClick,
|
|
133
|
-
language
|
|
147
|
+
language,
|
|
148
|
+
dense = false
|
|
134
149
|
}) {
|
|
150
|
+
const styles = useMemo(() => getStyles(dense), [dense]);
|
|
135
151
|
const [anchorElSettingsMenu, setAnchorElSettingsMenu] = useState(null);
|
|
136
152
|
const [anchorElAppsMenu, setAnchorElAppsMenu] = useState(null);
|
|
137
153
|
const {
|
|
@@ -196,15 +212,15 @@ function TopBar({
|
|
|
196
212
|
openUserSettingsDialog();
|
|
197
213
|
};
|
|
198
214
|
const logoClickable = useMemo(
|
|
199
|
-
() => /* @__PURE__ */ jsx(GridLogo, { onClick: onLogoClick, appLogo, appName, appColor }),
|
|
200
|
-
[onLogoClick, appLogo, appName, appColor]
|
|
215
|
+
() => /* @__PURE__ */ jsx(GridLogo, { onClick: onLogoClick, appLogo, appName, appColor, dense }),
|
|
216
|
+
[onLogoClick, appLogo, appName, appColor, dense]
|
|
201
217
|
);
|
|
202
218
|
return /* @__PURE__ */ jsxs(AppBar, { position: "static", color: "default", children: [
|
|
203
219
|
user && developerMode && /* @__PURE__ */ jsx(DevModeBanner, {}),
|
|
204
|
-
/* @__PURE__ */ jsxs(Toolbar, { children: [
|
|
220
|
+
/* @__PURE__ */ jsxs(Toolbar, { variant: dense ? "dense" : "regular", sx: styles.toolbar, children: [
|
|
205
221
|
logoClickable,
|
|
206
222
|
/* @__PURE__ */ jsx(Box, { sx: styles.grow, children }),
|
|
207
|
-
user && /* @__PURE__ */ jsxs(Box, { children: [
|
|
223
|
+
user && !dense && /* @__PURE__ */ jsxs(Box, { children: [
|
|
208
224
|
/* @__PURE__ */ jsx(
|
|
209
225
|
IconButton,
|
|
210
226
|
{
|
|
@@ -273,7 +289,7 @@ function TopBar({
|
|
|
273
289
|
"data-testid": "SettingsMenu",
|
|
274
290
|
children: [
|
|
275
291
|
/* @__PURE__ */ jsx(Box, { component: "span", sx: styles.name, children: user.profile.name !== void 0 ? abbreviationFromUserName(user.profile.name) : "" }),
|
|
276
|
-
anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon })
|
|
292
|
+
!dense && (anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon }))
|
|
277
293
|
]
|
|
278
294
|
}
|
|
279
295
|
),
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
-
export declare function useIntlRef(): import('react').
|
|
7
|
+
export declare function useIntlRef(): import('react').RefObject<import('react-intl').IntlShape>;
|