@gridsuite/commons-ui 0.280.0 → 0.282.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/composite/customAGGrid/custom-aggrid-filters/hooks/use-custom-aggrid-comparator-filter.js +1 -0
- package/dist/components/composite/customAGGrid/hooks/use-custom-aggrid-sort.js +1 -0
- package/dist/components/composite/reactQueryBuilder/OperatorSelector.js +1 -0
- package/dist/components/composite/report/QuickSearch.js +1 -0
- package/dist/components/composite/report/report-viewer/log-table/log-table.js +1 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.d.ts +6 -1
- package/dist/components/ui/dialogs/elementSaveDialog/ElementSaveDialog.js +29 -5
- package/dist/components/ui/directoryItemSelector/DirectoryItemSelector.js +1 -0
- package/dist/components/ui/reactHookForm/booleans/RadioInput.d.ts +1 -0
- package/dist/components/ui/reactHookForm/booleans/RadioInput.js +2 -1
- package/dist/features/index.js +92 -12
- package/dist/features/network-modification-table/network-modifications-table.js +1 -0
- package/dist/features/network-modification-table/renderers/reference-link-cell.js +1 -1
- package/dist/features/network-modification-table/renderers/root-network-chip-cell.js +1 -0
- package/dist/features/network-modification-table/renderers/switch-cell.js +1 -0
- package/dist/features/network-modification-table/row/drag-row-clone.js +1 -0
- package/dist/features/network-modification-table/use-modifications-drag-and-drop.js +1 -0
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/battery/modification/BatteryDialogTabs.js +2 -2
- package/dist/features/network-modifications/battery/modification/BatteryModificationForm.d.ts +4 -1
- package/dist/features/network-modifications/battery/modification/BatteryModificationForm.js +7 -11
- package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/generator/modification/GeneratorDialogTabs.js +2 -2
- package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.d.ts +4 -1
- package/dist/features/network-modifications/generator/modification/GeneratorModificationForm.js +4 -8
- package/dist/features/network-modifications/index.d.ts +1 -1
- package/dist/features/network-modifications/index.js +81 -6
- package/dist/features/network-modifications/line/common/LineDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/line/common/LineDialogTabs.js +2 -2
- package/dist/features/network-modifications/line/common/LineForm.d.ts +4 -1
- package/dist/features/network-modifications/line/common/LineForm.js +7 -11
- package/dist/features/network-modifications/line/common/line.utils.d.ts +1 -1
- package/dist/features/network-modifications/load/common/LoadDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/load/common/LoadDialogTabs.js +2 -2
- package/dist/features/network-modifications/load/common/LoadForm.d.ts +4 -1
- package/dist/features/network-modifications/load/common/LoadForm.js +7 -11
- package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.d.ts +3 -2
- package/dist/features/network-modifications/static-var-compensator/common/static-var-compensator-dialog-tabs.js +2 -2
- package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.d.ts +4 -1
- package/dist/features/network-modifications/static-var-compensator/creation/static-var-compensator-creation-form.js +8 -11
- package/dist/features/network-modifications/tabular/TabularForm.d.ts +22 -0
- package/dist/features/network-modifications/tabular/TabularForm.js +536 -0
- package/dist/features/network-modifications/tabular/index.d.ts +7 -0
- package/dist/features/network-modifications/tabular/index.js +65 -0
- package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.d.ts +12 -0
- package/dist/features/network-modifications/tabular/properties/DefineTabularPropertiesDialog.js +123 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.d.ts +1 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertiesForm.js +87 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.d.ts +5 -0
- package/dist/features/network-modifications/tabular/properties/TabularPropertyForm.js +91 -0
- package/dist/features/network-modifications/tabular/properties/index.d.ts +4 -0
- package/dist/features/network-modifications/tabular/properties/index.js +13 -0
- package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.d.ts +26 -0
- package/dist/features/network-modifications/tabular/properties/tabularProperty.utils.js +50 -0
- package/dist/features/network-modifications/tabular/tabular.constants.d.ts +59 -0
- package/dist/features/network-modifications/tabular/tabular.constants.js +75 -0
- package/dist/features/network-modifications/tabular/tabular.types.d.ts +41 -0
- package/dist/features/network-modifications/tabular/tabular.types.js +8 -0
- package/dist/features/network-modifications/tabular/tabular.utils.d.ts +68 -0
- package/dist/features/network-modifications/tabular/tabular.utils.js +301 -0
- package/dist/features/network-modifications/tabular/tabularCreation.utils.d.ts +25 -0
- package/dist/features/network-modifications/tabular/tabularCreation.utils.js +276 -0
- package/dist/features/network-modifications/tabular/tabularModification.utils.d.ts +43 -0
- package/dist/features/network-modifications/tabular/tabularModification.utils.js +406 -0
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.d.ts +3 -3
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerDialogTabs.js +2 -2
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.d.ts +4 -1
- package/dist/features/network-modifications/twoWindingsTransformer/common/TwoWindingsTransformerForm.js +7 -11
- package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.d.ts +4 -7
- package/dist/features/network-modifications/voltageLevel/creation/VoltageLevelCreationForm.js +16 -19
- package/dist/features/network-modifications/voltageLevel/creation/index.d.ts +1 -1
- package/dist/features/network-modifications/voltageLevel/creation/index.js +3 -1
- package/dist/features/network-modifications/voltageLevel/index.d.ts +2 -1
- package/dist/features/network-modifications/voltageLevel/index.js +18 -4
- package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.d.ts → creation/CreateVoltageLevelTopologyForm.d.ts} +1 -1
- package/dist/features/network-modifications/voltageLevel/topology/{CreateVoltageLevelTopologyForm.js → creation/CreateVoltageLevelTopologyForm.js} +38 -38
- package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.d.ts → creation/voltageLevelTopologyCreation.types.d.ts} +1 -1
- package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.d.ts → creation/voltageLevelTopologyCreation.utils.d.ts} +1 -1
- package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.utils.js → creation/voltageLevelTopologyCreation.utils.js} +5 -5
- package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.d.ts +6 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/ConnectionCellRender.js +80 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.d.ts +10 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/VoltageLevelTopologyModificationForm.js +284 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/constants.d.ts +10 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/constants.js +10 -0
- package/dist/features/network-modifications/{hooks → voltageLevel/topology/modification}/index.d.ts +4 -1
- package/dist/features/network-modifications/voltageLevel/topology/modification/index.js +14 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.d.ts +28 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.types.js +1 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.d.ts +29 -0
- package/dist/features/network-modifications/voltageLevel/topology/modification/voltageLevelTopologyModification.utils.js +124 -0
- package/dist/features/parameters/common/hook/index.d.ts +0 -1
- package/dist/features/parameters/common/hook/index.js +1 -3
- package/dist/features/parameters/common/index.d.ts +1 -0
- package/dist/features/parameters/common/index.js +3 -3
- package/dist/features/parameters/common/parameter-field.d.ts +2 -2
- package/dist/features/parameters/common/parameter-field.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.d.ts +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-form.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation-inline.js +10 -10
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.d.ts +1 -0
- package/dist/features/parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js +2 -0
- package/dist/features/parameters/dynamic-margin-calculation/loads-variations-parameters.js +1 -1
- package/dist/features/parameters/dynamic-margin-calculation/time-delay-parameters.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/contingency-parameters.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +9 -9
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.d.ts +1 -0
- package/dist/features/parameters/dynamic-security-analysis/dynamic-security-analysis.type.js +2 -0
- package/dist/features/parameters/dynamic-security-analysis/scenario-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/curve/dialog/curve-preview.js +1 -0
- package/dist/features/parameters/dynamic-simulation/curve/dialog/equipment-filter.js +1 -0
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-inline.js +9 -9
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.d.ts +1 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation-parameters-form.js +1 -1
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.d.ts +1 -0
- package/dist/features/parameters/dynamic-simulation/dynamic-simulation.type.js +2 -0
- package/dist/features/parameters/dynamic-simulation/network/network-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/common-solver/common-solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/ida-solver/ida-solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/sim-solver/simplified-solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/solver/solver-parameters.js +1 -1
- package/dist/features/parameters/dynamic-simulation/time-delay/time-delay-parameters.js +1 -1
- package/dist/features/parameters/index.js +12 -7
- package/dist/features/parameters/loadflow/load-flow-advanced-parameters.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-general-parameters.js +1 -1
- package/dist/features/parameters/loadflow/load-flow-parameters-inline.js +6 -6
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.d.ts +1 -0
- package/dist/features/parameters/loadflow/load-flow-parameters-utils.js +2 -0
- package/dist/features/parameters/loadflow/load-flow-provider-specific-parameters.js +1 -1
- package/dist/features/parameters/loadflow/use-load-flow-parameters-form.js +3 -3
- package/dist/features/parameters/network-visualizations/constants.d.ts +1 -0
- package/dist/features/parameters/network-visualizations/constants.js +2 -0
- package/dist/features/parameters/network-visualizations/index.js +2 -1
- package/dist/features/parameters/network-visualizations/network-visualizations-parameters-inline.js +6 -6
- package/dist/features/parameters/network-visualizations/use-network-visualizations-parameters-form.js +3 -7
- package/dist/features/parameters/pcc-min/pcc-min-parameters-inline.js +6 -6
- package/dist/features/parameters/security-analysis/constants.d.ts +1 -0
- package/dist/features/parameters/security-analysis/constants.js +2 -0
- package/dist/features/parameters/security-analysis/index.js +2 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-content.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-dialog.js +1 -1
- package/dist/features/parameters/security-analysis/security-analysis-parameters-inline.js +6 -6
- package/dist/features/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -3
- package/dist/features/parameters/sensi/columns-definitions.d.ts +2 -0
- package/dist/features/parameters/sensi/columns-definitions.js +36 -1
- package/dist/features/parameters/sensi/index.js +3 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-dialog.js +1 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-form.js +2 -1
- package/dist/features/parameters/sensi/sensitivity-analysis-parameters-inline.js +10 -7
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.d.ts +3 -1
- package/dist/features/parameters/sensi/sensitivity-parameters-selector.js +19 -35
- package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.d.ts +9 -1
- package/dist/features/parameters/sensi/use-sensitivity-analysis-parameters.js +29 -1
- package/dist/features/parameters/short-circuit/short-circuit-parameters-inline.js +6 -6
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.d.ts +1 -0
- package/dist/features/parameters/short-circuit/short-circuit-parameters-utils.js +2 -0
- package/dist/features/parameters/short-circuit/use-short-circuit-parameters-form.js +3 -3
- package/dist/features/parameters/voltage-init/constants.d.ts +1 -0
- package/dist/features/parameters/voltage-init/constants.js +2 -0
- package/dist/features/parameters/voltage-init/index.js +2 -1
- package/dist/features/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -8
- package/dist/features/parameters/voltage-init/voltage-init-parameters-inline.js +6 -6
- package/dist/features/process-configs/loadflow/lf-process-config-edition.js +7 -1
- package/dist/features/process-configs/security-analysis/sa-process-config-edition.js +7 -1
- package/dist/features/process-configs/shortcircuit/sc-process-config-edition.js +7 -1
- package/dist/features/results/loadflow/limit-violation-result.js +1 -1
- package/dist/features/results/shortcircuit/shortcircuit-analysis-result.js +1 -1
- package/dist/features/side-bar/AppSideBarHeader.js +20 -5
- package/dist/features/side-bar/EnvironmentChip.d.ts +13 -0
- package/dist/features/side-bar/EnvironmentChip.js +49 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/use-tabs.d.ts +33 -0
- package/dist/hooks/use-tabs.js +55 -0
- package/dist/index.js +97 -13
- package/dist/services/appsMetadata.d.ts +2 -0
- package/dist/services/directory.d.ts +1 -1
- package/dist/services/directory.js +6 -2
- package/dist/services/index.js +2 -1
- package/dist/services/userAdmin.d.ts +2 -1
- package/dist/services/userAdmin.js +9 -1
- package/dist/translations/en/businessErrorsEn.d.ts +1 -0
- package/dist/translations/en/businessErrorsEn.js +1 -0
- package/dist/translations/en/networkModificationsEn.d.ts +85 -0
- package/dist/translations/en/networkModificationsEn.js +91 -1
- package/dist/translations/fr/businessErrorsFr.d.ts +1 -0
- package/dist/translations/fr/businessErrorsFr.js +1 -0
- package/dist/translations/fr/networkModificationsFr.d.ts +85 -0
- package/dist/translations/fr/networkModificationsFr.js +91 -1
- package/dist/utils/constants/index.js +2 -1
- package/dist/utils/constants/notificationsProvider.d.ts +1 -0
- package/dist/utils/constants/notificationsProvider.js +1 -0
- package/dist/utils/constants/translationKeys.d.ts +1 -0
- package/dist/utils/constants/translationKeys.js +2 -0
- package/dist/utils/index.js +2 -1
- package/dist/utils/types/types.d.ts +4 -0
- package/package.json +1 -1
- package/dist/features/network-modifications/hooks/index.js +0 -4
- package/dist/features/network-modifications/hooks/useTabsWithError.d.ts +0 -15
- package/dist/features/network-modifications/hooks/useTabsWithError.js +0 -28
- package/dist/features/parameters/common/hook/use-tabs.d.ts +0 -16
- package/dist/features/parameters/common/hook/use-tabs.js +0 -65
- /package/dist/features/network-modifications/voltageLevel/topology/{index.d.ts → creation/index.d.ts} +0 -0
- /package/dist/features/network-modifications/voltageLevel/topology/{index.js → creation/index.js} +0 -0
- /package/dist/features/network-modifications/voltageLevel/topology/{voltageLevelTopologyCreation.types.js → creation/voltageLevelTopologyCreation.types.js} +0 -0
|
@@ -41,15 +41,19 @@ import "../../parameters/common/contingency-table/columns-definitions.js";
|
|
|
41
41
|
import "@hookform/resolvers/yup";
|
|
42
42
|
import "../../parameters/network-visualizations/constants.js";
|
|
43
43
|
import "../../parameters/loadflow/load-flow-parameters-context.js";
|
|
44
|
-
import "../../parameters/loadflow/load-flow-
|
|
44
|
+
import "../../parameters/loadflow/load-flow-parameters-utils.js";
|
|
45
45
|
import "../../parameters/loadflow/load-flow-parameters-content.js";
|
|
46
46
|
import "../../parameters/short-circuit/short-circuit-parameters-content.js";
|
|
47
|
+
import "../../parameters/short-circuit/short-circuit-parameters-utils.js";
|
|
48
|
+
import "../../parameters/voltage-init/constants.js";
|
|
47
49
|
import "../../parameters/voltage-init/voltage-init-form-utils.js";
|
|
48
50
|
import "react-dom";
|
|
51
|
+
import "../../parameters/security-analysis/constants.js";
|
|
49
52
|
import "../../parameters/security-analysis/security-analysis-parameters-utils.js";
|
|
50
53
|
import "../../parameters/sensi/utils.js";
|
|
51
54
|
import "../../parameters/sensi/columns-definitions.js";
|
|
52
55
|
import "../../parameters/dynamic-simulation/use-dynamic-simulation-parameters-form.js";
|
|
56
|
+
import "../../parameters/dynamic-simulation/dynamic-simulation.type.js";
|
|
53
57
|
import "../../parameters/dynamic-simulation/time-delay/time-delay-parameters-utils.js";
|
|
54
58
|
import "../../parameters/dynamic-simulation/time-delay/time-delay-parameters.js";
|
|
55
59
|
import "../../parameters/dynamic-simulation/solver/solver-parameters-utils.js";
|
|
@@ -66,8 +70,10 @@ import "mathjs";
|
|
|
66
70
|
import "../../parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js";
|
|
67
71
|
import "../../parameters/dynamic-security-analysis/scenario-parameters.js";
|
|
68
72
|
import "../../parameters/dynamic-security-analysis/contingency-parameters.js";
|
|
73
|
+
import "../../parameters/dynamic-security-analysis/dynamic-security-analysis.type.js";
|
|
69
74
|
import "../../parameters/dynamic-margin-calculation/time-delay-parameters.js";
|
|
70
75
|
import "../../parameters/dynamic-margin-calculation/loads-variations-parameters.js";
|
|
76
|
+
import "../../parameters/dynamic-margin-calculation/dynamic-margin-calculation.type.js";
|
|
71
77
|
import "../../parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js";
|
|
72
78
|
function SCProcessConfigEdition() {
|
|
73
79
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -12,9 +12,9 @@ import "localized-countries/data/fr";
|
|
|
12
12
|
import "localized-countries/data/en";
|
|
13
13
|
import "notistack";
|
|
14
14
|
import { useOpenLoaderShortWait } from "../../../hooks/useOpenLoaderShortWait.js";
|
|
15
|
+
import "react-hook-form";
|
|
15
16
|
import { RESULTS_LOADING_DELAY } from "../constants.js";
|
|
16
17
|
import "../../../components/ui/overflowableText/OverflowableText.js";
|
|
17
|
-
import "react-hook-form";
|
|
18
18
|
import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
19
19
|
import "yup";
|
|
20
20
|
import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
@@ -17,8 +17,8 @@ import "localized-countries/data/fr";
|
|
|
17
17
|
import "localized-countries/data/en";
|
|
18
18
|
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
19
19
|
import { useOpenLoaderShortWait } from "../../../hooks/useOpenLoaderShortWait.js";
|
|
20
|
-
import "../../../components/ui/overflowableText/OverflowableText.js";
|
|
21
20
|
import "react-hook-form";
|
|
21
|
+
import "../../../components/ui/overflowableText/OverflowableText.js";
|
|
22
22
|
import "../../../components/ui/reactHookForm/provider/CustomFormProvider.js";
|
|
23
23
|
import "yup";
|
|
24
24
|
import "../../../components/ui/treeViewFinder/TreeViewFinder.js";
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Stack,
|
|
2
|
+
import { Stack, Box, Typography, Tooltip, IconButton, Divider } from "@mui/material";
|
|
3
3
|
import { Info } from "@mui/icons-material";
|
|
4
|
+
import { useState, useEffect } from "react";
|
|
4
5
|
import { useAppSideBarDialogs, SideBarDialogType } from "./dialogs/AppSideBarDialogProvider.js";
|
|
6
|
+
import { fetchEnv } from "../../services/appsMetadata.js";
|
|
7
|
+
import "../../utils/conversionUtils.js";
|
|
8
|
+
import "../../utils/types/equipmentType.js";
|
|
9
|
+
import { EnvironmentChip } from "./EnvironmentChip.js";
|
|
5
10
|
function AppSideBarHeader({
|
|
6
11
|
isMinimized,
|
|
7
12
|
isLoggedIn,
|
|
@@ -11,6 +16,10 @@ function AppSideBarHeader({
|
|
|
11
16
|
appVersion
|
|
12
17
|
}) {
|
|
13
18
|
const { setOpenDialog } = useAppSideBarDialogs();
|
|
19
|
+
const [environment, setEnvironment] = useState("");
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
fetchEnv().then((env) => setEnvironment(env?.environment ?? ""));
|
|
22
|
+
}, []);
|
|
14
23
|
return /* @__PURE__ */ jsxs(
|
|
15
24
|
Stack,
|
|
16
25
|
{
|
|
@@ -21,10 +30,16 @@ function AppSideBarHeader({
|
|
|
21
30
|
spacing: 1,
|
|
22
31
|
children: [
|
|
23
32
|
/* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: isMinimized ? "center" : "flex-start", children: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
33
|
+
/* @__PURE__ */ jsxs(Box, { sx: { position: "relative", display: "inline-block" }, children: [
|
|
34
|
+
appLogo,
|
|
35
|
+
isMinimized && /* @__PURE__ */ jsx(EnvironmentChip, { environment, variant: "minimized" })
|
|
36
|
+
] }),
|
|
37
|
+
!isMinimized && /* @__PURE__ */ jsxs(Box, { sx: { position: "relative", display: "inline-block" }, children: [
|
|
38
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "h6", children: [
|
|
39
|
+
"Grid",
|
|
40
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: { color: appNameColor }, children: appName })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ jsx(EnvironmentChip, { environment, variant: "expanded" })
|
|
28
43
|
] })
|
|
29
44
|
] }),
|
|
30
45
|
/* @__PURE__ */ jsx(
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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
|
+
type EnvironmentChipVariant = 'minimized' | 'expanded';
|
|
8
|
+
interface EnvironmentChipProps {
|
|
9
|
+
environment: string;
|
|
10
|
+
variant: EnvironmentChipVariant;
|
|
11
|
+
}
|
|
12
|
+
export declare function EnvironmentChip({ environment, variant }: Readonly<EnvironmentChipProps>): import("react").JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Chip } from "@mui/material";
|
|
3
|
+
const envColors = {
|
|
4
|
+
REC: "#304FFE",
|
|
5
|
+
DEV: "#DD2C00",
|
|
6
|
+
PRE: "#AA00FF",
|
|
7
|
+
PRO: "#DD2C00",
|
|
8
|
+
DCH: "#2E7D32"
|
|
9
|
+
};
|
|
10
|
+
const variantStyles = {
|
|
11
|
+
minimized: {
|
|
12
|
+
transform: "translate(40%, -10%)",
|
|
13
|
+
height: "12px"
|
|
14
|
+
},
|
|
15
|
+
expanded: {
|
|
16
|
+
transform: "translate(120%, -10%)",
|
|
17
|
+
height: "15px"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function isEnvironment(value) {
|
|
21
|
+
return value in envColors;
|
|
22
|
+
}
|
|
23
|
+
function EnvironmentChip({ environment, variant }) {
|
|
24
|
+
if (!isEnvironment(environment)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Chip,
|
|
29
|
+
{
|
|
30
|
+
label: environment,
|
|
31
|
+
size: "small",
|
|
32
|
+
sx: {
|
|
33
|
+
position: "absolute",
|
|
34
|
+
top: 0,
|
|
35
|
+
right: 5,
|
|
36
|
+
fontSize: "0.5rem",
|
|
37
|
+
backgroundColor: envColors[environment],
|
|
38
|
+
color: "#ffffff",
|
|
39
|
+
"& .MuiChip-label": {
|
|
40
|
+
padding: "0 4px"
|
|
41
|
+
},
|
|
42
|
+
...variantStyles[variant]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
EnvironmentChip
|
|
49
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { useSelectAppearance } from "./useSelectAppearance.js";
|
|
|
13
13
|
import { OptionalServicesStatus, useParametersBackend } from "./use-parameters-backend.js";
|
|
14
14
|
import { useGetLabelEquipmentTypes } from "./useGetLabelEquipmentTypes.js";
|
|
15
15
|
import { useOpenLoaderShortWait } from "./useOpenLoaderShortWait.js";
|
|
16
|
+
import { useTabs } from "./use-tabs.js";
|
|
16
17
|
export {
|
|
17
18
|
OptionalServicesStatus,
|
|
18
19
|
getComputedLanguage,
|
|
@@ -31,5 +32,6 @@ export {
|
|
|
31
32
|
useSelectAppearance,
|
|
32
33
|
useSnackMessage,
|
|
33
34
|
useStateBoolean,
|
|
34
|
-
useStateNumber
|
|
35
|
+
useStateNumber,
|
|
36
|
+
useTabs
|
|
35
37
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SyntheticEvent } from 'react';
|
|
2
|
+
import { FieldErrors } from 'react-hook-form';
|
|
3
|
+
export type UseTabsProps<TTabValue extends string | number> = {
|
|
4
|
+
defaultTab: TTabValue;
|
|
5
|
+
/**
|
|
6
|
+
* Live form errors (usually `formState.errors`). Used to refresh the
|
|
7
|
+
* highlight when the user switches tabs. Navigation NEVER reacts to it:
|
|
8
|
+
* the only navigation trigger is `onError`.
|
|
9
|
+
*/
|
|
10
|
+
errors?: FieldErrors;
|
|
11
|
+
/** All possible tab values. Required if `tabFields` is omitted. */
|
|
12
|
+
tabValues?: TTabValue[];
|
|
13
|
+
/**
|
|
14
|
+
* Maps each tab value to the react-hook-form field path(s) whose validity
|
|
15
|
+
* decides whether the tab is highlighted. Falls back to `[String(tabValue)]`.
|
|
16
|
+
*/
|
|
17
|
+
tabFields?: Partial<Record<TTabValue, string[]>>;
|
|
18
|
+
};
|
|
19
|
+
export type UseTabsReturn<TTabValue extends string | number> = {
|
|
20
|
+
selectedTab: TTabValue;
|
|
21
|
+
setSelectedTab: (tab: TTabValue) => void;
|
|
22
|
+
/** Errored tabs, excluding the currently selected one. */
|
|
23
|
+
tabsWithError: TTabValue[];
|
|
24
|
+
/** Handler for MUI `<Tabs onChange>`. Refreshes the highlight. */
|
|
25
|
+
onTabChange: (event: SyntheticEvent<Element, Event>, newValue: TTabValue) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Invalid-submit handler — pass it as the 2nd argument of
|
|
28
|
+
* `handleSubmit(onSubmit, onError)`. This is the ONLY place navigation happens:
|
|
29
|
+
* stays on the current tab if it has errors, otherwise jumps to the first errored tab.
|
|
30
|
+
*/
|
|
31
|
+
onError: (errors: FieldErrors) => void;
|
|
32
|
+
};
|
|
33
|
+
export declare function useTabs<TTabValue extends string | number>({ defaultTab, errors, tabValues, tabFields, }: Readonly<UseTabsProps<TTabValue>>): UseTabsReturn<TTabValue>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback } from "react";
|
|
2
|
+
import { get } from "react-hook-form";
|
|
3
|
+
import { isObjectEmpty } from "../utils/functions.js";
|
|
4
|
+
function useTabs({
|
|
5
|
+
defaultTab,
|
|
6
|
+
errors,
|
|
7
|
+
tabValues,
|
|
8
|
+
tabFields
|
|
9
|
+
}) {
|
|
10
|
+
const [selectedTab, setSelectedTab] = useState(defaultTab);
|
|
11
|
+
const [tabsWithError, setTabsWithError] = useState([]);
|
|
12
|
+
const resolvedTabValues = useMemo(() => {
|
|
13
|
+
if (tabValues?.length) {
|
|
14
|
+
return tabValues;
|
|
15
|
+
}
|
|
16
|
+
return Object.keys(tabFields ?? {}).map((key) => {
|
|
17
|
+
const asNumber = Number(key);
|
|
18
|
+
return Number.isNaN(asNumber) ? key : asNumber;
|
|
19
|
+
});
|
|
20
|
+
}, [tabValues, tabFields]);
|
|
21
|
+
const getTabsWithError = useCallback(
|
|
22
|
+
(_errors) => resolvedTabValues.filter((tabValue) => {
|
|
23
|
+
const fields = tabFields?.[tabValue] ?? [String(tabValue)];
|
|
24
|
+
return fields.some((field) => get(_errors, field));
|
|
25
|
+
}),
|
|
26
|
+
[resolvedTabValues, tabFields]
|
|
27
|
+
);
|
|
28
|
+
const onTabChange = useCallback(
|
|
29
|
+
(_event, newSelectedTab) => {
|
|
30
|
+
setSelectedTab(newSelectedTab);
|
|
31
|
+
const erroredTabs = errors && !isObjectEmpty(errors) ? getTabsWithError(errors) : [];
|
|
32
|
+
setTabsWithError(erroredTabs.filter((errorTab) => errorTab !== newSelectedTab));
|
|
33
|
+
},
|
|
34
|
+
[errors, getTabsWithError]
|
|
35
|
+
);
|
|
36
|
+
const onError = useCallback(
|
|
37
|
+
(_errors) => {
|
|
38
|
+
if (!_errors || isObjectEmpty(_errors)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const erroredTabs = getTabsWithError(_errors);
|
|
42
|
+
if (erroredTabs.includes(selectedTab)) {
|
|
43
|
+
setTabsWithError(erroredTabs.filter((errorTab) => errorTab !== selectedTab));
|
|
44
|
+
} else if (erroredTabs.length > 0) {
|
|
45
|
+
setSelectedTab(erroredTabs[0]);
|
|
46
|
+
setTabsWithError(erroredTabs.slice(1));
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
[getTabsWithError, selectedTab]
|
|
50
|
+
);
|
|
51
|
+
return { selectedTab, setSelectedTab, tabsWithError, onTabChange, onError };
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
useTabs
|
|
55
|
+
};
|