@gridsuite/commons-ui 0.178.0 → 0.180.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.
Files changed (118) hide show
  1. package/dist/components/index.js +79 -1
  2. package/dist/components/inputs/index.js +2 -0
  3. package/dist/components/inputs/reactHookForm/CheckboxNullableInput.d.ts +15 -0
  4. package/dist/components/inputs/reactHookForm/CheckboxNullableInput.js +75 -0
  5. package/dist/components/inputs/reactHookForm/index.d.ts +1 -0
  6. package/dist/components/inputs/reactHookForm/index.js +2 -0
  7. package/dist/components/network-modifications/common/connectivity/BranchConnectivityForm.d.ts +7 -0
  8. package/dist/components/network-modifications/common/connectivity/BranchConnectivityForm.js +63 -0
  9. package/dist/components/network-modifications/common/connectivity/ConnectivityForm.d.ts +37 -0
  10. package/dist/components/network-modifications/common/connectivity/ConnectivityForm.js +267 -0
  11. package/dist/components/network-modifications/common/connectivity/connectivity.type.d.ts +34 -0
  12. package/dist/components/network-modifications/common/connectivity/connectivity.type.js +1 -0
  13. package/dist/components/network-modifications/common/connectivity/connectivityForm.utils.d.ts +241 -0
  14. package/dist/components/network-modifications/common/connectivity/connectivityForm.utils.js +196 -0
  15. package/dist/components/network-modifications/common/connectivity/index.d.ts +10 -0
  16. package/dist/components/network-modifications/common/connectivity/index.js +25 -0
  17. package/dist/components/network-modifications/common/index.d.ts +4 -1
  18. package/dist/components/network-modifications/common/index.js +56 -1
  19. package/dist/components/network-modifications/common/measurements/BranchActiveReactivePowerMeasurementsForm.d.ts +2 -0
  20. package/dist/components/network-modifications/common/measurements/BranchActiveReactivePowerMeasurementsForm.js +37 -0
  21. package/dist/components/network-modifications/common/measurements/PowerMeasurementsForm.d.ts +9 -0
  22. package/dist/components/network-modifications/common/measurements/PowerMeasurementsForm.js +52 -0
  23. package/dist/components/network-modifications/common/measurements/PowerWithValidityForm.d.ts +2 -0
  24. package/dist/components/network-modifications/common/measurements/PowerWithValidityForm.js +74 -0
  25. package/dist/components/network-modifications/common/measurements/branchActiveReactivePowerForm.utils.d.ts +56 -0
  26. package/dist/components/network-modifications/common/measurements/branchActiveReactivePowerForm.utils.js +69 -0
  27. package/dist/components/network-modifications/common/measurements/index.d.ts +13 -0
  28. package/dist/components/network-modifications/common/measurements/index.js +26 -0
  29. package/dist/components/network-modifications/common/measurements/injectionActiveReactivePowerForm.utils.d.ts +58 -0
  30. package/dist/components/network-modifications/common/measurements/injectionActiveReactivePowerForm.utils.js +55 -0
  31. package/dist/components/network-modifications/common/measurements/measurement.type.d.ts +13 -0
  32. package/dist/components/network-modifications/common/measurements/measurement.type.js +1 -0
  33. package/dist/components/network-modifications/common/measurements/powerWithValidity.utils.d.ts +22 -0
  34. package/dist/components/network-modifications/common/measurements/powerWithValidity.utils.js +36 -0
  35. package/dist/components/network-modifications/common/setpoints/SetPointsForm.d.ts +15 -0
  36. package/dist/components/network-modifications/common/setpoints/SetPointsForm.js +71 -0
  37. package/dist/components/network-modifications/common/setpoints/index.d.ts +8 -0
  38. package/dist/components/network-modifications/common/setpoints/index.js +10 -0
  39. package/dist/components/network-modifications/common/setpoints/setPoints.utils.d.ts +16 -0
  40. package/dist/components/network-modifications/common/setpoints/setPoints.utils.js +62 -0
  41. package/dist/components/network-modifications/index.d.ts +1 -0
  42. package/dist/components/network-modifications/index.js +71 -1
  43. package/dist/components/network-modifications/load/common/LoadDialogHeader.d.ts +7 -0
  44. package/dist/components/network-modifications/load/common/LoadDialogHeader.js +103 -0
  45. package/dist/components/network-modifications/load/common/LoadDialogTabs.d.ts +14 -0
  46. package/dist/components/network-modifications/load/common/LoadDialogTabs.js +49 -0
  47. package/dist/components/network-modifications/load/common/LoadDialogTabsContent.d.ts +8 -0
  48. package/dist/components/network-modifications/load/common/LoadDialogTabsContent.js +61 -0
  49. package/dist/components/network-modifications/load/common/LoadForm.d.ts +5 -0
  50. package/dist/components/network-modifications/load/common/LoadForm.js +73 -0
  51. package/dist/components/network-modifications/load/common/index.d.ts +12 -0
  52. package/dist/components/network-modifications/load/common/index.js +12 -0
  53. package/dist/components/network-modifications/load/common/load.types.d.ts +16 -0
  54. package/dist/components/network-modifications/load/common/load.types.js +1 -0
  55. package/dist/components/network-modifications/load/common/load.utils.d.ts +11 -0
  56. package/dist/components/network-modifications/load/common/load.utils.js +8 -0
  57. package/dist/components/network-modifications/load/creation/index.d.ts +8 -0
  58. package/dist/components/network-modifications/load/creation/index.js +7 -0
  59. package/dist/components/network-modifications/load/creation/loadCreation.types.d.ts +16 -0
  60. package/dist/components/network-modifications/load/creation/loadCreation.types.js +1 -0
  61. package/dist/components/network-modifications/load/creation/loadCreation.utils.d.ts +53 -0
  62. package/dist/components/network-modifications/load/creation/loadCreation.utils.js +98 -0
  63. package/dist/components/network-modifications/load/index.d.ts +8 -0
  64. package/dist/components/network-modifications/load/index.js +17 -0
  65. package/dist/components/network-modifications/substation/creation/substationCreation.utils.js +2 -1
  66. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.js +3 -0
  67. package/dist/components/network-modifications/voltage-level/index.d.ts +1 -0
  68. package/dist/components/network-modifications/voltage-level/voltage-level.type.d.ts +12 -0
  69. package/dist/components/network-modifications/voltage-level/voltage-level.type.js +1 -0
  70. package/dist/components/parameters/common/utils.d.ts +25 -2
  71. package/dist/components/parameters/common/utils.js +40 -1
  72. package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.d.ts +2 -18
  73. package/dist/components/parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js +2 -38
  74. package/dist/components/parameters/dynamic-security-analysis/constants.d.ts +9 -0
  75. package/dist/components/parameters/dynamic-security-analysis/constants.js +8 -0
  76. package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.d.ts +10 -0
  77. package/dist/components/parameters/dynamic-security-analysis/contingency-parameters.js +65 -0
  78. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.d.ts +10 -0
  79. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-inline.js +130 -0
  80. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.d.ts +9 -0
  81. package/dist/components/parameters/dynamic-security-analysis/dynamic-security-analysis-parameters-form.js +103 -0
  82. package/dist/components/parameters/dynamic-security-analysis/index.d.ts +8 -0
  83. package/dist/components/parameters/dynamic-security-analysis/index.js +8 -0
  84. package/dist/components/parameters/dynamic-security-analysis/scenario-parameters.d.ts +10 -0
  85. package/dist/components/parameters/dynamic-security-analysis/scenario-parameters.js +16 -0
  86. package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.d.ts +51 -0
  87. package/dist/components/parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js +181 -0
  88. package/dist/components/parameters/index.d.ts +1 -0
  89. package/dist/components/parameters/index.js +6 -0
  90. package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +24 -4
  91. package/dist/components/parameters/util/make-component-utils.d.ts +17 -0
  92. package/dist/components/parameters/util/make-component-utils.js +96 -0
  93. package/dist/components/parameters/util/styles.d.ts +38 -0
  94. package/dist/components/parameters/util/styles.js +41 -0
  95. package/dist/index.js +95 -4
  96. package/dist/services/dynamic-security-analysis.d.ts +4 -0
  97. package/dist/services/dynamic-security-analysis.js +29 -0
  98. package/dist/services/index.d.ts +1 -0
  99. package/dist/services/index.js +6 -1
  100. package/dist/services/sensitivity-analysis.d.ts +1 -1
  101. package/dist/services/sensitivity-analysis.js +3 -2
  102. package/dist/services/utils.d.ts +2 -0
  103. package/dist/services/utils.js +3 -0
  104. package/dist/translations/en/networkModificationsEn.d.ts +17 -0
  105. package/dist/translations/en/networkModificationsEn.js +18 -1
  106. package/dist/translations/fr/networkModificationsFr.d.ts +17 -0
  107. package/dist/translations/fr/networkModificationsFr.js +18 -1
  108. package/dist/utils/constants/fieldConstants.d.ts +24 -1
  109. package/dist/utils/constants/fieldConstants.js +24 -1
  110. package/dist/utils/index.js +10 -2
  111. package/dist/utils/ts-utils.d.ts +5 -6
  112. package/dist/utils/ts-utils.js +11 -0
  113. package/dist/utils/types/elementType.d.ts +1 -0
  114. package/dist/utils/types/elementType.js +1 -0
  115. package/dist/utils/types/equipmentType.d.ts +18 -0
  116. package/dist/utils/types/equipmentType.js +27 -1
  117. package/dist/utils/types/index.js +8 -2
  118. package/package.json +1 -1
@@ -0,0 +1,14 @@
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
+ interface LoadDialogTabsProps {
8
+ tabIndex: number;
9
+ tabIndexesWithError: number[];
10
+ setTabIndex: (newTabIndex: number) => void;
11
+ isModification?: boolean;
12
+ }
13
+ export declare function LoadDialogTabs({ tabIndex, tabIndexesWithError, setTabIndex, isModification, }: Readonly<LoadDialogTabsProps>): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,49 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Grid, Tabs, Tab } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { LoadDialogTab } from "./load.utils.js";
5
+ import { getTabIndicatorStyle, getTabStyle } from "../../../parameters/parameters-style.js";
6
+ function LoadDialogTabs({
7
+ tabIndex,
8
+ tabIndexesWithError,
9
+ setTabIndex,
10
+ isModification = false
11
+ }) {
12
+ return /* @__PURE__ */ jsx(Grid, { container: true, children: /* @__PURE__ */ jsxs(
13
+ Tabs,
14
+ {
15
+ value: tabIndex,
16
+ variant: "scrollable",
17
+ onChange: (event, newValue) => setTabIndex(newValue),
18
+ TabIndicatorProps: {
19
+ sx: getTabIndicatorStyle(tabIndexesWithError, tabIndex)
20
+ },
21
+ children: [
22
+ /* @__PURE__ */ jsx(
23
+ Tab,
24
+ {
25
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "ConnectivityTab" }),
26
+ sx: getTabStyle(tabIndexesWithError, LoadDialogTab.CONNECTIVITY_TAB)
27
+ }
28
+ ),
29
+ /* @__PURE__ */ jsx(
30
+ Tab,
31
+ {
32
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "LineCharacteristicsTab" }),
33
+ sx: getTabStyle(tabIndexesWithError, LoadDialogTab.CHARACTERISTICS_TAB)
34
+ }
35
+ ),
36
+ isModification && /* @__PURE__ */ jsx(
37
+ Tab,
38
+ {
39
+ label: /* @__PURE__ */ jsx(FormattedMessage, { id: "StateEstimationTab" }),
40
+ sx: getTabStyle(tabIndexesWithError, LoadDialogTab.STATE_ESTIMATION_TAB)
41
+ }
42
+ )
43
+ ]
44
+ }
45
+ ) });
46
+ }
47
+ export {
48
+ LoadDialogTabs
49
+ };
@@ -0,0 +1,8 @@
1
+ import { LoadFormInfos } from './load.types';
2
+ import { ConnectivityNetworkProps } from '../../common/connectivity/connectivity.type';
3
+ export interface LoadDialogTabsContentProps extends ConnectivityNetworkProps {
4
+ loadToModify?: LoadFormInfos | null;
5
+ isModification?: boolean;
6
+ tabIndex: number;
7
+ }
8
+ export declare function LoadDialogTabsContent({ loadToModify, isModification, tabIndex, voltageLevelOptions, PositionDiagramPane, fetchBusesOrBusbarSections, }: Readonly<LoadDialogTabsContentProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,61 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { Box } from "@mui/material";
3
+ import { LoadDialogTab } from "./load.utils.js";
4
+ import { PowerMeasurementsForm } from "../../common/measurements/PowerMeasurementsForm.js";
5
+ import GridSection from "../../../grid/grid-section.js";
6
+ import { ConnectivityForm } from "../../common/connectivity/ConnectivityForm.js";
7
+ import { PropertiesForm } from "../../common/properties/PropertiesForm.js";
8
+ import { SetPointsForm } from "../../common/setpoints/SetPointsForm.js";
9
+ function LoadDialogTabsContent({
10
+ loadToModify,
11
+ isModification = false,
12
+ tabIndex,
13
+ voltageLevelOptions = [],
14
+ PositionDiagramPane,
15
+ fetchBusesOrBusbarSections
16
+ }) {
17
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ /* @__PURE__ */ jsx(Box, { hidden: tabIndex !== LoadDialogTab.CONNECTIVITY_TAB, p: 1, children: /* @__PURE__ */ jsx(
19
+ ConnectivityForm,
20
+ {
21
+ withPosition: true,
22
+ isEquipmentModification: isModification,
23
+ previousValues: {
24
+ connectablePosition: loadToModify?.connectablePosition,
25
+ voltageLevelId: loadToModify?.voltageLevelId,
26
+ busOrBusbarSectionId: loadToModify?.busOrBusbarSectionId,
27
+ terminalConnected: loadToModify?.terminalConnected
28
+ },
29
+ voltageLevelOptions,
30
+ PositionDiagramPane,
31
+ fetchBusesOrBusbarSections
32
+ }
33
+ ) }),
34
+ /* @__PURE__ */ jsxs(Box, { hidden: tabIndex !== LoadDialogTab.CHARACTERISTICS_TAB, p: 1, sx: { marginTop: -4 }, children: [
35
+ /* @__PURE__ */ jsx(
36
+ SetPointsForm,
37
+ {
38
+ previousValues: {
39
+ activePower: loadToModify?.p0,
40
+ reactivePower: loadToModify?.q0
41
+ },
42
+ isModification
43
+ }
44
+ ),
45
+ /* @__PURE__ */ jsx(PropertiesForm, { networkElementType: "load", isModification })
46
+ ] }),
47
+ isModification && /* @__PURE__ */ jsxs(Box, { hidden: tabIndex !== LoadDialogTab.STATE_ESTIMATION_TAB, p: 1, sx: { marginTop: -4 }, children: [
48
+ /* @__PURE__ */ jsx(GridSection, { title: "MeasurementsSection" }),
49
+ /* @__PURE__ */ jsx(
50
+ PowerMeasurementsForm,
51
+ {
52
+ activePowerMeasurement: loadToModify?.measurementP,
53
+ reactivePowerMeasurement: loadToModify?.measurementQ
54
+ }
55
+ )
56
+ ] })
57
+ ] });
58
+ }
59
+ export {
60
+ LoadDialogTabsContent
61
+ };
@@ -0,0 +1,5 @@
1
+ import { LoadDialogTabsContentProps } from './LoadDialogTabsContent';
2
+ import { LoadDialogHeaderProps } from './LoadDialogHeader';
3
+ export interface LoadFormProps extends LoadDialogHeaderProps, Omit<LoadDialogTabsContentProps, 'tabIndex' | 'isModification' | 'loadToModify'> {
4
+ }
5
+ export declare function LoadForm({ loadToModify, equipmentId, isModification, voltageLevelOptions, fetchBusesOrBusbarSections, PositionDiagramPane, }: Readonly<LoadFormProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { Grid } from "@mui/material";
4
+ import { useFormState } from "react-hook-form";
5
+ import { LoadDialogTabsContent } from "./LoadDialogTabsContent.js";
6
+ import { LoadDialogHeader } from "./LoadDialogHeader.js";
7
+ import { LoadDialogTab } from "./load.utils.js";
8
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
9
+ import "../../../../utils/conversionUtils.js";
10
+ import "../../../../utils/types/equipmentType.js";
11
+ import "@mui/icons-material";
12
+ import "../../../../utils/yupConfig.js";
13
+ import { LoadDialogTabs } from "./LoadDialogTabs.js";
14
+ function LoadForm({
15
+ loadToModify,
16
+ equipmentId,
17
+ isModification,
18
+ voltageLevelOptions,
19
+ fetchBusesOrBusbarSections,
20
+ PositionDiagramPane
21
+ }) {
22
+ const [tabIndexesWithError, setTabIndexesWithError] = useState([]);
23
+ const [tabIndex, setTabIndex] = useState(LoadDialogTab.CONNECTIVITY_TAB);
24
+ const { errors } = useFormState();
25
+ useEffect(() => {
26
+ const tabsInError = [];
27
+ if (errors?.[FieldConstants.CONNECTIVITY] !== void 0) {
28
+ tabsInError.push(LoadDialogTab.CONNECTIVITY_TAB);
29
+ }
30
+ if (errors?.[FieldConstants.ACTIVE_POWER_SET_POINT] !== void 0 || errors?.[FieldConstants.REACTIVE_POWER_SET_POINT] !== void 0 || errors?.[FieldConstants.ADDITIONAL_PROPERTIES] !== void 0) {
31
+ tabsInError.push(LoadDialogTab.CHARACTERISTICS_TAB);
32
+ }
33
+ if (tabsInError.length > 0) {
34
+ setTabIndex((currentTabIndex) => {
35
+ return tabsInError.includes(currentTabIndex) ? currentTabIndex : tabsInError[0];
36
+ });
37
+ }
38
+ setTabIndexesWithError(tabsInError);
39
+ }, [errors]);
40
+ return /* @__PURE__ */ jsxs(Grid, { container: true, direction: "column", spacing: 2, children: [
41
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
42
+ LoadDialogHeader,
43
+ {
44
+ loadToModify,
45
+ equipmentId,
46
+ isModification
47
+ }
48
+ ) }),
49
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
50
+ LoadDialogTabs,
51
+ {
52
+ tabIndex,
53
+ tabIndexesWithError,
54
+ setTabIndex,
55
+ isModification
56
+ }
57
+ ) }),
58
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
59
+ LoadDialogTabsContent,
60
+ {
61
+ tabIndex,
62
+ loadToModify,
63
+ isModification,
64
+ voltageLevelOptions,
65
+ fetchBusesOrBusbarSections,
66
+ PositionDiagramPane
67
+ }
68
+ ) })
69
+ ] });
70
+ }
71
+ export {
72
+ LoadForm
73
+ };
@@ -0,0 +1,12 @@
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
+ export * from './load.types';
8
+ export * from './load.utils';
9
+ export * from './LoadDialogTabs';
10
+ export * from './LoadDialogTabsContent';
11
+ export * from './LoadDialogHeader';
12
+ export * from './LoadForm';
@@ -0,0 +1,12 @@
1
+ import { LoadDialogTab } from "./load.utils.js";
2
+ import { LoadDialogTabs } from "./LoadDialogTabs.js";
3
+ import { LoadDialogTabsContent } from "./LoadDialogTabsContent.js";
4
+ import { LoadDialogHeader } from "./LoadDialogHeader.js";
5
+ import { LoadForm } from "./LoadForm.js";
6
+ export {
7
+ LoadDialogHeader,
8
+ LoadDialogTab,
9
+ LoadDialogTabs,
10
+ LoadDialogTabsContent,
11
+ LoadForm
12
+ };
@@ -0,0 +1,16 @@
1
+ import { MeasurementInfo } from '../../common/measurements/measurement.type';
2
+ import { ConnectablePositionFormInfos } from '../../common/connectivity/connectivity.type';
3
+ export interface LoadFormInfos {
4
+ id: string;
5
+ name: string;
6
+ type: string;
7
+ p0: number;
8
+ q0: number;
9
+ voltageLevelId: string;
10
+ connectablePosition: ConnectablePositionFormInfos;
11
+ busOrBusbarSectionId: string;
12
+ terminalConnected?: boolean | null;
13
+ measurementP: MeasurementInfo | undefined;
14
+ measurementQ: MeasurementInfo | undefined;
15
+ properties: Record<string, string> | undefined;
16
+ }
@@ -0,0 +1,11 @@
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 declare const LoadDialogTab: {
8
+ CONNECTIVITY_TAB: number;
9
+ CHARACTERISTICS_TAB: number;
10
+ STATE_ESTIMATION_TAB: number;
11
+ };
@@ -0,0 +1,8 @@
1
+ const LoadDialogTab = {
2
+ CONNECTIVITY_TAB: 0,
3
+ CHARACTERISTICS_TAB: 1,
4
+ STATE_ESTIMATION_TAB: 2
5
+ };
6
+ export {
7
+ LoadDialogTab
8
+ };
@@ -0,0 +1,8 @@
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
+ export * from './loadCreation.types';
8
+ export * from './loadCreation.utils';
@@ -0,0 +1,7 @@
1
+ import { loadCreationDtoToForm, loadCreationEmptyFormData, loadCreationFormSchema, loadCreationFormToDto } from "./loadCreation.utils.js";
2
+ export {
3
+ loadCreationDtoToForm,
4
+ loadCreationEmptyFormData,
5
+ loadCreationFormSchema,
6
+ loadCreationFormToDto
7
+ };
@@ -0,0 +1,16 @@
1
+ import { Property } from '../../common';
2
+ export interface LoadCreationDto {
3
+ type: string;
4
+ equipmentId: string;
5
+ equipmentName: string | null;
6
+ loadType: string;
7
+ p0: number;
8
+ q0: number;
9
+ voltageLevelId: string;
10
+ busOrBusbarSectionId: string;
11
+ connectionDirection: string | null;
12
+ connectionName?: string | null;
13
+ connectionPosition?: number | null;
14
+ terminalConnected?: boolean | null;
15
+ properties: Property[] | null;
16
+ }
@@ -0,0 +1,53 @@
1
+ import { InferType } from 'yup';
2
+ import { DeepNullable } from '../../../../utils';
3
+ import { LoadCreationDto } from './loadCreation.types';
4
+ export declare const loadCreationFormSchema: import('yup').ObjectSchema<NonNullable<{
5
+ equipmentID: string;
6
+ equipmentName: string | null | undefined;
7
+ loadType: string | null | undefined;
8
+ activePowerSetpoint: number;
9
+ reactivePowerSetpoint: number;
10
+ connectivity: {
11
+ terminalConnected?: boolean | null | undefined;
12
+ connectionDirection?: string | null | undefined;
13
+ connectionName?: string | undefined;
14
+ connectionPosition?: number | null | undefined;
15
+ busOrBusbarSection: {
16
+ id?: string | undefined;
17
+ } | null;
18
+ voltageLevel: {
19
+ id?: string | undefined;
20
+ } | null;
21
+ };
22
+ } & {
23
+ AdditionalProperties: {
24
+ previousValue?: string | null | undefined;
25
+ added: NonNullable<boolean | undefined>;
26
+ deletionMark: NonNullable<boolean | undefined>;
27
+ name: string;
28
+ value: string;
29
+ }[] | undefined;
30
+ }>, import('yup').AnyObject, {
31
+ equipmentID: undefined;
32
+ equipmentName: undefined;
33
+ loadType: undefined;
34
+ activePowerSetpoint: undefined;
35
+ reactivePowerSetpoint: undefined;
36
+ connectivity: {
37
+ voltageLevel: {
38
+ id: undefined;
39
+ };
40
+ busOrBusbarSection: {
41
+ id: undefined;
42
+ };
43
+ connectionDirection: undefined;
44
+ connectionName: undefined;
45
+ connectionPosition: undefined;
46
+ terminalConnected: undefined;
47
+ };
48
+ AdditionalProperties: "";
49
+ }, "">;
50
+ export type LoadCreationFormData = InferType<typeof loadCreationFormSchema>;
51
+ export declare const loadCreationEmptyFormData: DeepNullable<LoadCreationFormData>;
52
+ export declare const loadCreationDtoToForm: (loadDto: LoadCreationDto) => LoadCreationFormData;
53
+ export declare const loadCreationFormToDto: (loadForm: LoadCreationFormData) => LoadCreationDto;
@@ -0,0 +1,98 @@
1
+ import { object, number, string } from "yup";
2
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
3
+ import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
4
+ import "../../../../utils/conversionUtils.js";
5
+ import { UNDEFINED_CONNECTION_DIRECTION, UNDEFINED_LOAD_TYPE } from "../../../../utils/types/equipmentType.js";
6
+ import { ModificationType } from "../../../../utils/types/modificationType.js";
7
+ import "react/jsx-runtime";
8
+ import "@mui/icons-material";
9
+ import { sanitizeString } from "../../../../utils/ts-utils.js";
10
+ import "../../../../utils/yupConfig.js";
11
+ import { getConnectivityWithPositionSchema, getConnectivityWithPositionEmptyFormDataProps, getConnectivityFormDataProps } from "../../common/connectivity/connectivityForm.utils.js";
12
+ import "@mui/material";
13
+ import "react";
14
+ import "react-hook-form";
15
+ import "react-intl";
16
+ import "../../../overflowableText/OverflowableText.js";
17
+ import "localized-countries";
18
+ import "localized-countries/data/fr";
19
+ import "localized-countries/data/en";
20
+ import "notistack";
21
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
22
+ import "../../../treeViewFinder/TreeViewFinder.js";
23
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
24
+ import "../../../customAGGrid/customAggrid.js";
25
+ import "ag-grid-community";
26
+ import "react-papaparse";
27
+ import "react-csv-downloader";
28
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
29
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
30
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
31
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
32
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
33
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
34
+ import "@react-querybuilder/material";
35
+ import "../../../filter/expert/expertFilterConstants.js";
36
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
37
+ import "uuid";
38
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
39
+ import "react-querybuilder";
40
+ import { creationPropertiesSchema, getFilledPropertiesFromModification, toModificationProperties } from "../../common/properties/propertyUtils.js";
41
+ const loadCreationFormSchema = object().shape({
42
+ [FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED),
43
+ [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
44
+ [FieldConstants.LOAD_TYPE]: string().nullable(),
45
+ [FieldConstants.ACTIVE_POWER_SET_POINT]: number().nullable().required(YUP_REQUIRED),
46
+ [FieldConstants.REACTIVE_POWER_SET_POINT]: number().nullable().required(YUP_REQUIRED),
47
+ [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(false)
48
+ }).concat(creationPropertiesSchema).required(YUP_REQUIRED);
49
+ const loadCreationEmptyFormData = {
50
+ equipmentID: "",
51
+ equipmentName: "",
52
+ loadType: null,
53
+ activePowerSetpoint: null,
54
+ reactivePowerSetpoint: null,
55
+ AdditionalProperties: [],
56
+ connectivity: getConnectivityWithPositionEmptyFormDataProps()
57
+ };
58
+ const loadCreationDtoToForm = (loadDto) => {
59
+ return {
60
+ equipmentID: loadDto.equipmentId,
61
+ equipmentName: loadDto.equipmentName ?? "",
62
+ loadType: loadDto.loadType,
63
+ activePowerSetpoint: loadDto.p0,
64
+ reactivePowerSetpoint: loadDto.q0,
65
+ AdditionalProperties: getFilledPropertiesFromModification(loadDto.properties),
66
+ connectivity: getConnectivityFormDataProps({
67
+ voltageLevelId: loadDto.voltageLevelId,
68
+ busbarSectionId: loadDto.busOrBusbarSectionId,
69
+ connectionDirection: loadDto.connectionDirection,
70
+ connectionName: loadDto.connectionName,
71
+ connectionPosition: loadDto.connectionPosition,
72
+ terminalConnected: loadDto.terminalConnected
73
+ })
74
+ };
75
+ };
76
+ const loadCreationFormToDto = (loadForm) => {
77
+ return {
78
+ type: ModificationType.LOAD_CREATION,
79
+ equipmentId: loadForm.equipmentID,
80
+ equipmentName: sanitizeString(loadForm.equipmentName),
81
+ loadType: loadForm.loadType ?? UNDEFINED_LOAD_TYPE,
82
+ p0: loadForm.activePowerSetpoint,
83
+ q0: loadForm.reactivePowerSetpoint,
84
+ voltageLevelId: loadForm.connectivity.voltageLevel?.id ?? "",
85
+ busOrBusbarSectionId: loadForm.connectivity.busOrBusbarSection?.id ?? "",
86
+ connectionDirection: loadForm.connectivity.connectionDirection ?? UNDEFINED_CONNECTION_DIRECTION,
87
+ connectionName: sanitizeString(loadForm.connectivity.connectionName),
88
+ connectionPosition: loadForm.connectivity.connectionPosition,
89
+ terminalConnected: loadForm.connectivity.terminalConnected,
90
+ properties: toModificationProperties(loadForm)
91
+ };
92
+ };
93
+ export {
94
+ loadCreationDtoToForm,
95
+ loadCreationEmptyFormData,
96
+ loadCreationFormSchema,
97
+ loadCreationFormToDto
98
+ };
@@ -0,0 +1,8 @@
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
+ export * from './common';
8
+ export * from './creation';
@@ -0,0 +1,17 @@
1
+ import { LoadDialogTab } from "./common/load.utils.js";
2
+ import { LoadDialogTabs } from "./common/LoadDialogTabs.js";
3
+ import { LoadDialogTabsContent } from "./common/LoadDialogTabsContent.js";
4
+ import { LoadDialogHeader } from "./common/LoadDialogHeader.js";
5
+ import { LoadForm } from "./common/LoadForm.js";
6
+ import { loadCreationDtoToForm, loadCreationEmptyFormData, loadCreationFormSchema, loadCreationFormToDto } from "./creation/loadCreation.utils.js";
7
+ export {
8
+ LoadDialogHeader,
9
+ LoadDialogTab,
10
+ LoadDialogTabs,
11
+ LoadDialogTabsContent,
12
+ LoadForm,
13
+ loadCreationDtoToForm,
14
+ loadCreationEmptyFormData,
15
+ loadCreationFormSchema,
16
+ loadCreationFormToDto
17
+ };
@@ -4,13 +4,14 @@ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
4
4
  import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
5
5
  import "../../../../utils/conversionUtils.js";
6
6
  import "../../../../utils/types/equipmentType.js";
7
+ import { ModificationType } from "../../../../utils/types/modificationType.js";
7
8
  import "react/jsx-runtime";
8
9
  import "@mui/icons-material";
9
10
  import { sanitizeString } from "../../../../utils/ts-utils.js";
10
11
  import "../../../../utils/yupConfig.js";
11
12
  const substationCreationFormToDto = (substationForm) => {
12
13
  return {
13
- type: "SUBSTATION_CREATION",
14
+ type: ModificationType.SUBSTATION_CREATION,
14
15
  equipmentId: substationForm.equipmentID,
15
16
  equipmentName: sanitizeString(substationForm.equipmentName),
16
17
  country: substationForm.country ?? null,
@@ -50,6 +50,9 @@ import "../../../../parameters/sensi/columns-definitions.js";
50
50
  import "../../../../parameters/dynamic-margin-calculation/time-delay-parameters.js";
51
51
  import "../../../../parameters/dynamic-margin-calculation/loads-variations-parameters.js";
52
52
  import "../../../../parameters/dynamic-margin-calculation/use-dynamic-margin-calculation-parameters-form.js";
53
+ import "../../../../parameters/dynamic-security-analysis/use-dynamic-security-analysis-parameters-form.js";
54
+ import "../../../../parameters/dynamic-security-analysis/scenario-parameters.js";
55
+ import "../../../../parameters/dynamic-security-analysis/contingency-parameters.js";
53
56
  function SubstationAutocompleteAddButton({ children, ...rest }) {
54
57
  const { setValue, getValues } = useFormContext();
55
58
  const intl = useIntl();
@@ -5,3 +5,4 @@
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
7
  export * from './creation';
8
+ export * from './voltage-level.type';
@@ -0,0 +1,12 @@
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 interface VoltageLevelFormInfos {
8
+ equipmentId: string;
9
+ equipmentName?: string | null;
10
+ substationId?: string | null;
11
+ topologyKind?: string | null;
12
+ }
@@ -1,7 +1,9 @@
1
- import { UseFormReturn } from 'react-hook-form';
1
+ import { ObjectSchema } from 'yup';
2
+ import { SyntheticEvent } from 'react';
3
+ import { FieldErrors, UseFormReturn } from 'react-hook-form';
2
4
  import { SpecificParameterInfos, SpecificParametersDescription, SpecificParametersValues } from '../../../utils';
3
5
  import { default as yup } from '../../../utils/yupConfig';
4
- export declare const getSpecificParametersFormSchema: (specificParameters: SpecificParameterInfos[] | undefined) => yup.ObjectSchema<{
6
+ export declare const getSpecificParametersFormSchema: (specificParameters: SpecificParameterInfos[] | undefined) => ObjectSchema<{
5
7
  specificParametersPerProvider: {};
6
8
  }, yup.AnyObject, {
7
9
  specificParametersPerProvider: {
@@ -12,3 +14,24 @@ export declare const getDefaultSpecificParamsValues: (specificParametersDescript
12
14
  export declare const formatSpecificParameters: (specificParametersDescriptionForProvider: SpecificParameterInfos[], specificParamsList: SpecificParametersValues) => SpecificParametersValues;
13
15
  export declare const getAllSpecificParametersValues: (formData: Record<string, any>, _specificParametersValues: SpecificParametersValues) => SpecificParametersValues;
14
16
  export declare const setSpecificParameters: (provider: string, specificParamsDescriptions: SpecificParametersDescription | null, formMethods: UseFormReturn) => void;
17
+ type UseTabsReturn<TTabValue extends string> = {
18
+ selectedTab: TTabValue;
19
+ tabsWithError: TTabValue[];
20
+ onTabChange: (event: SyntheticEvent, newValue: TTabValue) => void;
21
+ onError: (errors: FieldErrors) => void;
22
+ };
23
+ export type UseComputationParametersFormReturn<TTabValue extends string> = UseTabsReturn<TTabValue> & {
24
+ formMethods: UseFormReturn;
25
+ formSchema: ObjectSchema<any>;
26
+ paramsLoaded: boolean;
27
+ formattedProviders: {
28
+ id: string;
29
+ label: string;
30
+ }[];
31
+ };
32
+ type UseTabsProps<TTabValue extends string> = {
33
+ defaultTab: TTabValue;
34
+ tabEnum: Record<string, TTabValue>;
35
+ };
36
+ export declare function useTabs<TTabValue extends string>({ defaultTab, tabEnum, }: Readonly<UseTabsProps<TTabValue>>): UseTabsReturn<TTabValue>;
37
+ export {};
@@ -1,6 +1,8 @@
1
+ import { useState, useCallback } from "react";
1
2
  import "../../../utils/conversionUtils.js";
2
3
  import "../../../utils/types/equipmentType.js";
3
4
  import { ParameterType } from "../../../utils/types/parameters.type.js";
5
+ import { isObjectEmpty } from "../../../utils/functions.js";
4
6
  import "react/jsx-runtime";
5
7
  import "@mui/icons-material";
6
8
  import "../../../utils/yupConfig.js";
@@ -80,10 +82,47 @@ const setSpecificParameters = (provider, specificParamsDescriptions, formMethods
80
82
  const specificParamsValues = getDefaultSpecificParamsValues(specificParams);
81
83
  formMethods.setValue(SPECIFIC_PARAMETERS, specificParamsValues);
82
84
  };
85
+ function useTabs({
86
+ defaultTab,
87
+ tabEnum
88
+ }) {
89
+ const [tabValue, setTabValue] = useState(defaultTab);
90
+ const [tabValuesWithError, setTabValuesWithError] = useState([]);
91
+ const handleTabChange = useCallback((event, newValue) => {
92
+ setTabValue(newValue);
93
+ }, []);
94
+ const onError = useCallback(
95
+ (errors) => {
96
+ if (!errors || isObjectEmpty(errors)) {
97
+ return;
98
+ }
99
+ const tabsInError = [];
100
+ Object.values(tabEnum).forEach((tab) => {
101
+ if (errors?.[tab] && tab !== tabValue) {
102
+ tabsInError.push(tab);
103
+ }
104
+ });
105
+ if (tabsInError.includes(tabValue)) {
106
+ setTabValuesWithError(tabsInError.filter((errorTab) => errorTab !== tabValue));
107
+ } else if (tabsInError.length > 0) {
108
+ setTabValue(tabsInError[0]);
109
+ setTabValuesWithError(tabsInError.filter((errorTab, index, arr) => errorTab !== arr[0]));
110
+ }
111
+ },
112
+ [tabValue, tabEnum]
113
+ );
114
+ return {
115
+ selectedTab: tabValue,
116
+ tabsWithError: tabValuesWithError,
117
+ onTabChange: handleTabChange,
118
+ onError
119
+ };
120
+ }
83
121
  export {
84
122
  formatSpecificParameters,
85
123
  getAllSpecificParametersValues,
86
124
  getDefaultSpecificParamsValues,
87
125
  getSpecificParametersFormSchema,
88
- setSpecificParameters
126
+ setSpecificParameters,
127
+ useTabs
89
128
  };