@gridsuite/commons-ui 0.177.0 → 0.178.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 (55) hide show
  1. package/dist/components/index.js +25 -1
  2. package/dist/components/inputs/index.js +2 -0
  3. package/dist/components/inputs/reactHookForm/index.js +2 -0
  4. package/dist/components/inputs/reactHookForm/numbers/IntegerInput.js +1 -1
  5. package/dist/components/inputs/reactHookForm/selectInputs/EnumInput.d.ts +18 -0
  6. package/dist/components/inputs/reactHookForm/selectInputs/EnumInput.js +28 -0
  7. package/dist/components/inputs/reactHookForm/selectInputs/index.d.ts +1 -0
  8. package/dist/components/inputs/reactHookForm/selectInputs/index.js +2 -0
  9. package/dist/components/network-modifications/index.d.ts +1 -0
  10. package/dist/components/network-modifications/index.js +23 -1
  11. package/dist/components/network-modifications/voltage-level/creation/VoltageLevelCreationForm.d.ts +11 -0
  12. package/dist/components/network-modifications/voltage-level/creation/VoltageLevelCreationForm.js +174 -0
  13. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.d.ts +7 -0
  14. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.js +54 -0
  15. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.d.ts +7 -0
  16. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.js +73 -0
  17. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/index.d.ts +8 -0
  18. package/dist/components/network-modifications/voltage-level/creation/coupling-omnibus/index.js +6 -0
  19. package/dist/components/network-modifications/voltage-level/creation/index.d.ts +11 -0
  20. package/dist/components/network-modifications/voltage-level/creation/index.js +24 -0
  21. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.d.ts +5 -0
  22. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationAutocompleteAddButton.js +76 -0
  23. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationCreationSection.d.ts +6 -0
  24. package/dist/components/network-modifications/voltage-level/creation/substation-creation/SubstationCreationSection.js +61 -0
  25. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.d.ts +7 -0
  26. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.js +119 -0
  27. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.d.ts +11 -0
  28. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.js +82 -0
  29. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialogSubmitButton.d.ts +6 -0
  30. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialogSubmitButton.js +11 -0
  31. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesForm.d.ts +11 -0
  32. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesForm.js +70 -0
  33. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/createSwitchesDialog.utils.d.ts +14 -0
  34. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/createSwitchesDialog.utils.js +27 -0
  35. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/index.d.ts +7 -0
  36. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/creation/index.js +4 -0
  37. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/index.d.ts +8 -0
  38. package/dist/components/network-modifications/voltage-level/creation/switches-between-sections/index.js +6 -0
  39. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.d.ts +34 -0
  40. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.types.js +9 -0
  41. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.d.ts +155 -0
  42. package/dist/components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.js +248 -0
  43. package/dist/components/network-modifications/voltage-level/index.d.ts +7 -0
  44. package/dist/components/network-modifications/voltage-level/index.js +24 -0
  45. package/dist/index.js +26 -1
  46. package/dist/services/index.js +2 -1
  47. package/dist/services/networkModification.d.ts +1 -0
  48. package/dist/services/networkModification.js +15 -1
  49. package/dist/translations/en/networkModificationsEn.d.ts +35 -0
  50. package/dist/translations/en/networkModificationsEn.js +35 -0
  51. package/dist/translations/fr/networkModificationsFr.d.ts +35 -0
  52. package/dist/translations/fr/networkModificationsFr.js +35 -0
  53. package/dist/utils/constants/fieldConstants.d.ts +22 -1
  54. package/dist/utils/constants/fieldConstants.js +21 -0
  55. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ import { IntlShape } from 'react-intl';
2
+ import { InferType } from 'yup';
3
+ import { FieldConstants } from '../../../../utils';
4
+ import { SwitchKind, VoltageLevelCreationDto } from './voltageLevelCreation.types';
5
+ import { Option } from '../../../../utils/types/types';
6
+ export declare const SWITCH_TYPE: {
7
+ readonly BREAKER: {
8
+ readonly id: "BREAKER";
9
+ readonly label: "Breaker";
10
+ };
11
+ readonly DISCONNECTOR: {
12
+ readonly id: "DISCONNECTOR";
13
+ readonly label: "Disconnector";
14
+ };
15
+ };
16
+ export declare const buildNewBusbarSections: (equipmentId: string, sectionCount: number, busbarCount: number) => Option[];
17
+ export declare const getCreateSwitchesValidationSchema: (id?: FieldConstants) => {
18
+ [x: string]: import('yup').ArraySchema<{
19
+ switchKind: string;
20
+ }[] | null | undefined, import('yup').AnyObject, "", "">;
21
+ };
22
+ export declare const getCreateSwitchesEmptyFormData: (sectionCount: number, id?: FieldConstants) => {
23
+ [x: string]: any[];
24
+ };
25
+ export declare const voltageLevelCreationFormSchema: import('yup').ObjectSchema<{
26
+ equipmentID: string;
27
+ equipmentName: string | null | undefined;
28
+ addSubstationCreationId: NonNullable<boolean | undefined>;
29
+ substationId: string | null | undefined;
30
+ substationCreationId: string | null | undefined;
31
+ substationName: string | null | undefined;
32
+ country: string | null | undefined;
33
+ substationCreation: {
34
+ AdditionalProperties?: {
35
+ previousValue?: string | null | undefined;
36
+ added: NonNullable<boolean | undefined>;
37
+ deletionMark: NonNullable<boolean | undefined>;
38
+ name: string;
39
+ value: string;
40
+ }[] | undefined;
41
+ };
42
+ hideNominalVoltage: NonNullable<boolean | undefined>;
43
+ nominalV: number | null | undefined;
44
+ lowVoltageLimit: number | null | undefined;
45
+ highVoltageLimit: number | null | undefined;
46
+ lowShortCircuitCurrentLimit: number | null | undefined;
47
+ highShortCircuitCurrentLimit: number | null | undefined;
48
+ hideBusBarSection: NonNullable<boolean | undefined>;
49
+ busbarCount: number | null | undefined;
50
+ sectionCount: number | null | undefined;
51
+ switchesBetweenSections: string | null | undefined;
52
+ switchKinds: {
53
+ switchKind: string;
54
+ }[] | undefined;
55
+ topologyKind: string | null | undefined;
56
+ couplingOmnibus: {
57
+ busbarSectionId1: string;
58
+ busbarSectionId2: string;
59
+ }[] | undefined;
60
+ } & {
61
+ AdditionalProperties: {
62
+ previousValue?: string | null | undefined;
63
+ added: NonNullable<boolean | undefined>;
64
+ deletionMark: NonNullable<boolean | undefined>;
65
+ name: string;
66
+ value: string;
67
+ }[] | undefined;
68
+ }, import('yup').AnyObject, {
69
+ equipmentID: undefined;
70
+ equipmentName: undefined;
71
+ addSubstationCreationId: undefined;
72
+ substationId: undefined;
73
+ substationCreationId: undefined;
74
+ substationName: undefined;
75
+ country: undefined;
76
+ substationCreation: {
77
+ AdditionalProperties: "";
78
+ };
79
+ hideNominalVoltage: undefined;
80
+ nominalV: undefined;
81
+ lowVoltageLimit: undefined;
82
+ highVoltageLimit: undefined;
83
+ lowShortCircuitCurrentLimit: undefined;
84
+ highShortCircuitCurrentLimit: undefined;
85
+ hideBusBarSection: undefined;
86
+ busbarCount: undefined;
87
+ sectionCount: undefined;
88
+ switchesBetweenSections: undefined;
89
+ switchKinds: "";
90
+ topologyKind: undefined;
91
+ couplingOmnibus: "";
92
+ AdditionalProperties: "";
93
+ }, "">;
94
+ export type VoltageLevelCreationFormData = InferType<typeof voltageLevelCreationFormSchema>;
95
+ export declare const voltageLevelCreationEmptyFormData: {
96
+ equipmentID: string;
97
+ equipmentName: string;
98
+ addSubstationCreationId: false;
99
+ substationId: null;
100
+ substationCreationId: null;
101
+ substationName: null;
102
+ country: null;
103
+ substationCreation: {
104
+ AdditionalProperties?: {
105
+ previousValue?: string | null | undefined;
106
+ added: NonNullable<boolean | undefined>;
107
+ deletionMark: NonNullable<boolean | undefined>;
108
+ name: string;
109
+ value: string;
110
+ }[] | undefined;
111
+ country?: string | null | undefined;
112
+ equipmentName?: string | null | undefined;
113
+ equipmentID: string;
114
+ };
115
+ hideNominalVoltage: false;
116
+ nominalV: null;
117
+ lowVoltageLimit: null;
118
+ highVoltageLimit: null;
119
+ lowShortCircuitCurrentLimit: null;
120
+ highShortCircuitCurrentLimit: null;
121
+ hideBusBarSection: false;
122
+ busbarCount: number;
123
+ sectionCount: number;
124
+ switchesBetweenSections: string;
125
+ switchKinds: never[];
126
+ couplingOmnibus: never[];
127
+ AdditionalProperties: never[];
128
+ };
129
+ export declare const voltageLevelCreationFormToDto: (voltageLevelForm: VoltageLevelCreationFormData) => VoltageLevelCreationDto;
130
+ export declare const translateSwitchKinds: (switchKinds: SwitchKind[] | null, intl?: IntlShape) => string;
131
+ export declare const voltageLevelCreationDtoToForm: (voltageLevelDto: VoltageLevelCreationDto, intl?: IntlShape, includePreviousValue?: boolean) => {
132
+ AdditionalProperties?: import('../..').Property[];
133
+ equipmentID: string;
134
+ equipmentName: string;
135
+ substationId: string | null;
136
+ nominalV: number | null;
137
+ lowVoltageLimit: number | null;
138
+ highVoltageLimit: number | null;
139
+ lowShortCircuitCurrentLimit: any;
140
+ highShortCircuitCurrentLimit: any;
141
+ busbarCount: number;
142
+ sectionCount: number;
143
+ switchesBetweenSections: string;
144
+ couplingOmnibus: import('./voltageLevelCreation.types').CouplingDevice[];
145
+ switchKinds: {
146
+ switchKind: SwitchKind;
147
+ }[];
148
+ addSubstationCreationId: boolean;
149
+ substationCreationId: string | null;
150
+ substationName: string | null;
151
+ country: string | null;
152
+ substationCreation: import('../..').Properties;
153
+ hideNominalVoltage: boolean;
154
+ hideBusBarSection: boolean;
155
+ };
@@ -0,0 +1,248 @@
1
+ import { object, array, string, number, boolean, ref } from "yup";
2
+ import { creationPropertiesSchema, toModificationProperties, getPropertiesFromModification, emptyProperties } from "../../common/properties/propertyUtils.js";
3
+ import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
4
+ import { YUP_REQUIRED } from "../../../../utils/constants/translationKeys.js";
5
+ import { convertOutputValue, convertInputValue } from "../../../../utils/conversionUtils.js";
6
+ import "../../../../utils/types/equipmentType.js";
7
+ import { MODIFICATION_TYPES } from "../../../../utils/types/modificationType.js";
8
+ import { FieldType } from "../../../../utils/types/fieldType.js";
9
+ import "react/jsx-runtime";
10
+ import "@mui/icons-material";
11
+ import { sanitizeString } from "../../../../utils/ts-utils.js";
12
+ import "../../../../utils/yupConfig.js";
13
+ import "@mui/material";
14
+ import "react-intl";
15
+ import "../../../overflowableText/OverflowableText.js";
16
+ import "react";
17
+ import "react-hook-form";
18
+ import "localized-countries";
19
+ import "localized-countries/data/fr";
20
+ import "localized-countries/data/en";
21
+ import "notistack";
22
+ import "../../../inputs/reactHookForm/provider/CustomFormProvider.js";
23
+ import "../../../treeViewFinder/TreeViewFinder.js";
24
+ import "../../../inputs/reactHookForm/agGridTable/BottomRightButtons.js";
25
+ import "../../../customAGGrid/customAggrid.js";
26
+ import "ag-grid-community";
27
+ import "react-papaparse";
28
+ import "react-csv-downloader";
29
+ import "../../../inputs/reactHookForm/numbers/RangeInput.js";
30
+ import "@material-symbols/svg-400/outlined/left_panel_open.svg?react";
31
+ import "@material-symbols/svg-400/outlined/arrows_output.svg?react";
32
+ import "@material-symbols/svg-400/outlined/left_panel_close.svg?react";
33
+ import "@material-symbols/svg-400/outlined/add_notes.svg?react";
34
+ import "../../../dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
35
+ import "@react-querybuilder/material";
36
+ import "../../../filter/expert/expertFilterConstants.js";
37
+ import "../../../inputs/reactQueryBuilder/CustomReactQueryBuilder.js";
38
+ import "uuid";
39
+ import "../../../inputs/reactQueryBuilder/PropertyValueEditor.js";
40
+ import "react-querybuilder";
41
+ import { substationCreationEmptyFormData } from "../../substation/creation/substationCreation.utils.js";
42
+ import "../../substation/modification/substationModification.utils.js";
43
+ const SWITCH_TYPE = {
44
+ BREAKER: { id: "BREAKER", label: "Breaker" },
45
+ DISCONNECTOR: { id: "DISCONNECTOR", label: "Disconnector" }
46
+ };
47
+ const buildNewBusbarSections = (equipmentId, sectionCount, busbarCount) => {
48
+ const newBusbarSections = [];
49
+ for (let i = 0; i < busbarCount; i++) {
50
+ for (let j = 0; j < sectionCount; j++) {
51
+ newBusbarSections.push({
52
+ id: `${equipmentId}_${i + 1}_${j + 1}`,
53
+ label: ""
54
+ });
55
+ }
56
+ }
57
+ return newBusbarSections;
58
+ };
59
+ const getCreateSwitchesValidationSchema = (id = FieldConstants.SWITCH_KINDS) => {
60
+ return {
61
+ [id]: array().nullable().of(
62
+ object().shape({
63
+ [FieldConstants.SWITCH_KIND]: string().nullable().required(YUP_REQUIRED)
64
+ })
65
+ )
66
+ };
67
+ };
68
+ const getCreateSwitchesEmptyFormData = (sectionCount, id = FieldConstants.SWITCH_KINDS) => ({
69
+ [id]: new Array(sectionCount - 1).fill({ [FieldConstants.SWITCH_KIND]: "" })
70
+ });
71
+ const voltageLevelCreationFormSchema = object().shape({
72
+ [FieldConstants.EQUIPMENT_ID]: string().required(YUP_REQUIRED).when([FieldConstants.ADD_SUBSTATION_CREATION], {
73
+ is: (addSubstationCreation) => !addSubstationCreation,
74
+ then: (schema) => schema.notOneOf(
75
+ [ref(FieldConstants.SUBSTATION_ID), null],
76
+ "CreateSubstationInVoltageLevelIdenticalId"
77
+ )
78
+ }).when([FieldConstants.ADD_SUBSTATION_CREATION], {
79
+ is: (addSubstationCreation) => addSubstationCreation,
80
+ then: (schema) => schema.notOneOf(
81
+ [ref(FieldConstants.SUBSTATION_CREATION_ID), null],
82
+ "CreateSubstationInVoltageLevelIdenticalId"
83
+ )
84
+ }),
85
+ [FieldConstants.EQUIPMENT_NAME]: string().nullable(),
86
+ [FieldConstants.ADD_SUBSTATION_CREATION]: boolean().required(YUP_REQUIRED),
87
+ [FieldConstants.SUBSTATION_ID]: string().nullable().when([FieldConstants.ADD_SUBSTATION_CREATION], {
88
+ is: (addSubstationCreation) => !addSubstationCreation,
89
+ then: (schema) => schema.required(YUP_REQUIRED).notOneOf(
90
+ [ref(FieldConstants.EQUIPMENT_ID), null],
91
+ "CreateSubstationInVoltageLevelIdenticalId"
92
+ )
93
+ }),
94
+ [FieldConstants.SUBSTATION_CREATION_ID]: string().nullable().when([FieldConstants.ADD_SUBSTATION_CREATION], {
95
+ is: (addSubstationCreation) => addSubstationCreation,
96
+ then: (schema) => schema.required(YUP_REQUIRED).notOneOf(
97
+ [ref(FieldConstants.EQUIPMENT_ID), null],
98
+ "CreateSubstationInVoltageLevelIdenticalId"
99
+ )
100
+ }),
101
+ [FieldConstants.SUBSTATION_NAME]: string().nullable(),
102
+ [FieldConstants.COUNTRY]: string().nullable(),
103
+ [FieldConstants.SUBSTATION_CREATION]: creationPropertiesSchema,
104
+ [FieldConstants.HIDE_NOMINAL_VOLTAGE]: boolean().required(YUP_REQUIRED),
105
+ [FieldConstants.NOMINAL_V]: number().nullable().when([FieldConstants.HIDE_NOMINAL_VOLTAGE], {
106
+ is: (hideNominalVoltage) => !hideNominalVoltage,
107
+ then: (schema) => schema.min(0, "mustBeGreaterOrEqualToZero").required(YUP_REQUIRED)
108
+ }),
109
+ [FieldConstants.LOW_VOLTAGE_LIMIT]: number().nullable().min(0, "mustBeGreaterOrEqualToZero").max(ref(FieldConstants.HIGH_VOLTAGE_LIMIT), "voltageLevelNominalVoltageMaxValueError"),
110
+ [FieldConstants.HIGH_VOLTAGE_LIMIT]: number().nullable().min(0, "mustBeGreaterOrEqualToZero"),
111
+ [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").max(ref(FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT), "ShortCircuitCurrentLimitMinMaxError"),
112
+ [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: number().nullable().min(0, "ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero").when([FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT], {
113
+ is: (lowShortCircuitCurrentLimit) => lowShortCircuitCurrentLimit != null,
114
+ then: (schema) => schema.required(YUP_REQUIRED)
115
+ }),
116
+ [FieldConstants.HIDE_BUS_BAR_SECTION]: boolean().required(YUP_REQUIRED),
117
+ [FieldConstants.BUS_BAR_COUNT]: number().nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
118
+ is: (hideBusBarSection) => !hideBusBarSection,
119
+ then: (schema) => schema.min(1, "BusBarCountMustBeGreaterThanOrEqualToOne").required(YUP_REQUIRED)
120
+ }),
121
+ [FieldConstants.SECTION_COUNT]: number().nullable().when([FieldConstants.HIDE_BUS_BAR_SECTION], {
122
+ is: (hideBusBarSection) => !hideBusBarSection,
123
+ then: (schema) => schema.min(1, "SectionCountMustBeGreaterThanOrEqualToOne").required(YUP_REQUIRED)
124
+ }),
125
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: string().nullable().when([FieldConstants.SECTION_COUNT], {
126
+ is: (sectionCount) => sectionCount > 1,
127
+ then: (schema) => schema.required(YUP_REQUIRED)
128
+ }),
129
+ [FieldConstants.SWITCH_KINDS]: array().of(
130
+ object().shape({
131
+ [FieldConstants.SWITCH_KIND]: string().required(YUP_REQUIRED)
132
+ })
133
+ ),
134
+ [FieldConstants.TOPOLOGY_KIND]: string().nullable(),
135
+ [FieldConstants.COUPLING_OMNIBUS]: array().of(
136
+ object().shape({
137
+ [FieldConstants.BUS_BAR_SECTION_ID1]: string().nullable().required(YUP_REQUIRED),
138
+ [FieldConstants.BUS_BAR_SECTION_ID2]: string().nullable().required(YUP_REQUIRED).notOneOf([ref(FieldConstants.BUS_BAR_SECTION_ID1), null], "CreateCouplingDeviceIdenticalBusBar")
139
+ })
140
+ )
141
+ }).concat(creationPropertiesSchema);
142
+ const voltageLevelCreationEmptyFormData = {
143
+ [FieldConstants.EQUIPMENT_ID]: "",
144
+ [FieldConstants.EQUIPMENT_NAME]: "",
145
+ [FieldConstants.ADD_SUBSTATION_CREATION]: false,
146
+ [FieldConstants.SUBSTATION_ID]: null,
147
+ [FieldConstants.SUBSTATION_CREATION_ID]: null,
148
+ [FieldConstants.SUBSTATION_NAME]: null,
149
+ [FieldConstants.COUNTRY]: null,
150
+ [FieldConstants.SUBSTATION_CREATION]: substationCreationEmptyFormData,
151
+ [FieldConstants.HIDE_NOMINAL_VOLTAGE]: false,
152
+ [FieldConstants.NOMINAL_V]: null,
153
+ [FieldConstants.LOW_VOLTAGE_LIMIT]: null,
154
+ [FieldConstants.HIGH_VOLTAGE_LIMIT]: null,
155
+ [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: null,
156
+ [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: null,
157
+ [FieldConstants.HIDE_BUS_BAR_SECTION]: false,
158
+ [FieldConstants.BUS_BAR_COUNT]: 1,
159
+ [FieldConstants.SECTION_COUNT]: 1,
160
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: "",
161
+ [FieldConstants.SWITCH_KINDS]: [],
162
+ [FieldConstants.COUPLING_OMNIBUS]: [],
163
+ [FieldConstants.ADDITIONAL_PROPERTIES]: []
164
+ };
165
+ const voltageLevelCreationFormToDto = (voltageLevelForm) => {
166
+ const substationCreation = voltageLevelForm[FieldConstants.ADD_SUBSTATION_CREATION] ? {
167
+ type: MODIFICATION_TYPES.SUBSTATION_CREATION.type,
168
+ equipmentId: voltageLevelForm[FieldConstants.SUBSTATION_CREATION_ID] ?? "",
169
+ equipmentName: voltageLevelForm[FieldConstants.SUBSTATION_NAME] ?? null,
170
+ country: voltageLevelForm[FieldConstants.COUNTRY] ?? null,
171
+ properties: toModificationProperties(voltageLevelForm[FieldConstants.SUBSTATION_CREATION])
172
+ } : null;
173
+ return {
174
+ type: MODIFICATION_TYPES.VOLTAGE_LEVEL_CREATION.type,
175
+ equipmentId: voltageLevelForm[FieldConstants.EQUIPMENT_ID],
176
+ equipmentName: sanitizeString(voltageLevelForm[FieldConstants.EQUIPMENT_NAME]),
177
+ substationId: substationCreation ? null : voltageLevelForm[FieldConstants.SUBSTATION_ID] ?? null,
178
+ substationCreation,
179
+ nominalV: voltageLevelForm[FieldConstants.NOMINAL_V] ?? null,
180
+ lowVoltageLimit: voltageLevelForm[FieldConstants.LOW_VOLTAGE_LIMIT] ?? null,
181
+ highVoltageLimit: voltageLevelForm[FieldConstants.HIGH_VOLTAGE_LIMIT] ?? null,
182
+ ipMin: convertOutputValue(
183
+ FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
184
+ voltageLevelForm[FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]
185
+ ),
186
+ ipMax: convertOutputValue(
187
+ FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
188
+ voltageLevelForm[FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]
189
+ ),
190
+ busbarCount: voltageLevelForm[FieldConstants.BUS_BAR_COUNT] ?? 1,
191
+ sectionCount: voltageLevelForm[FieldConstants.SECTION_COUNT] ?? 1,
192
+ switchKinds: (voltageLevelForm[FieldConstants.SWITCH_KINDS] ?? []).map(
193
+ (e) => e[FieldConstants.SWITCH_KIND]
194
+ ),
195
+ couplingDevices: (voltageLevelForm[FieldConstants.COUPLING_OMNIBUS] ?? []).map((device) => ({
196
+ busbarSectionId1: device[FieldConstants.BUS_BAR_SECTION_ID1] ?? "",
197
+ busbarSectionId2: device[FieldConstants.BUS_BAR_SECTION_ID2] ?? ""
198
+ })),
199
+ properties: toModificationProperties(voltageLevelForm)
200
+ };
201
+ };
202
+ const translateSwitchKinds = (switchKinds, intl) => switchKinds?.map((kind) => intl ? intl.formatMessage({ id: kind }) : kind).join(" / ") ?? "";
203
+ const voltageLevelCreationDtoToForm = (voltageLevelDto, intl, includePreviousValue = true) => {
204
+ const isSubstationCreation = voltageLevelDto.substationCreation?.equipmentId != null;
205
+ const substationProperties = isSubstationCreation ? getPropertiesFromModification(voltageLevelDto.substationCreation?.properties, includePreviousValue) : emptyProperties;
206
+ return {
207
+ [FieldConstants.EQUIPMENT_ID]: voltageLevelDto.equipmentId,
208
+ [FieldConstants.EQUIPMENT_NAME]: voltageLevelDto.equipmentName ?? "",
209
+ [FieldConstants.SUBSTATION_ID]: isSubstationCreation ? null : voltageLevelDto.substationId,
210
+ [FieldConstants.NOMINAL_V]: voltageLevelDto.nominalV,
211
+ [FieldConstants.LOW_VOLTAGE_LIMIT]: voltageLevelDto.lowVoltageLimit,
212
+ [FieldConstants.HIGH_VOLTAGE_LIMIT]: voltageLevelDto.highVoltageLimit,
213
+ [FieldConstants.LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: convertInputValue(
214
+ FieldType.LOW_SHORT_CIRCUIT_CURRENT_LIMIT,
215
+ voltageLevelDto.ipMin
216
+ ),
217
+ [FieldConstants.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT]: convertInputValue(
218
+ FieldType.HIGH_SHORT_CIRCUIT_CURRENT_LIMIT,
219
+ voltageLevelDto.ipMax
220
+ ),
221
+ [FieldConstants.BUS_BAR_COUNT]: voltageLevelDto.busbarCount ?? 1,
222
+ [FieldConstants.SECTION_COUNT]: voltageLevelDto.sectionCount ?? 1,
223
+ [FieldConstants.SWITCHES_BETWEEN_SECTIONS]: translateSwitchKinds(voltageLevelDto.switchKinds, intl),
224
+ [FieldConstants.COUPLING_OMNIBUS]: voltageLevelDto.couplingDevices ?? [],
225
+ [FieldConstants.SWITCH_KINDS]: voltageLevelDto.switchKinds?.map((switchKind) => ({
226
+ switchKind
227
+ })) ?? [],
228
+ [FieldConstants.ADD_SUBSTATION_CREATION]: isSubstationCreation,
229
+ [FieldConstants.SUBSTATION_CREATION_ID]: isSubstationCreation ? voltageLevelDto.substationCreation.equipmentId : null,
230
+ [FieldConstants.SUBSTATION_NAME]: isSubstationCreation ? voltageLevelDto.substationCreation.equipmentName : null,
231
+ [FieldConstants.COUNTRY]: isSubstationCreation ? voltageLevelDto.substationCreation.country : null,
232
+ [FieldConstants.SUBSTATION_CREATION]: substationProperties,
233
+ [FieldConstants.HIDE_NOMINAL_VOLTAGE]: false,
234
+ [FieldConstants.HIDE_BUS_BAR_SECTION]: false,
235
+ ...getPropertiesFromModification(voltageLevelDto.properties, includePreviousValue)
236
+ };
237
+ };
238
+ export {
239
+ SWITCH_TYPE,
240
+ buildNewBusbarSections,
241
+ getCreateSwitchesEmptyFormData,
242
+ getCreateSwitchesValidationSchema,
243
+ translateSwitchKinds,
244
+ voltageLevelCreationDtoToForm,
245
+ voltageLevelCreationEmptyFormData,
246
+ voltageLevelCreationFormSchema,
247
+ voltageLevelCreationFormToDto
248
+ };
@@ -0,0 +1,7 @@
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 './creation';
@@ -0,0 +1,24 @@
1
+ import { CreateSwitchesDialog } from "./creation/switches-between-sections/creation/CreateSwitchesDialog.js";
2
+ import { SwitchesBetweenSections } from "./creation/switches-between-sections/SwitchesBetweenSections.js";
3
+ import { CouplingOmnibusForm } from "./creation/coupling-omnibus/CouplingOmnibusForm.js";
4
+ import { CouplingOmnibusCreation } from "./creation/coupling-omnibus/CouplingOmnibusCreation.js";
5
+ import { VoltageLevelCreationForm } from "./creation/VoltageLevelCreationForm.js";
6
+ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./creation/voltageLevelCreation.utils.js";
7
+ import { SwitchKind } from "./creation/voltageLevelCreation.types.js";
8
+ export {
9
+ CouplingOmnibusCreation,
10
+ CouplingOmnibusForm,
11
+ CreateSwitchesDialog,
12
+ SWITCH_TYPE,
13
+ SwitchKind,
14
+ SwitchesBetweenSections,
15
+ VoltageLevelCreationForm,
16
+ buildNewBusbarSections,
17
+ getCreateSwitchesEmptyFormData,
18
+ getCreateSwitchesValidationSchema,
19
+ translateSwitchKinds,
20
+ voltageLevelCreationDtoToForm,
21
+ voltageLevelCreationEmptyFormData,
22
+ voltageLevelCreationFormSchema,
23
+ voltageLevelCreationFormToDto
24
+ };
package/dist/index.js CHANGED
@@ -86,6 +86,7 @@ import { CountriesInput } from "./components/inputs/reactHookForm/selectInputs/C
86
86
  import { InputWithPopupConfirmation } from "./components/inputs/reactHookForm/selectInputs/InputWithPopupConfirmation.js";
87
87
  import { MuiSelectInput } from "./components/inputs/reactHookForm/selectInputs/MuiSelectInput.js";
88
88
  import { SelectInput } from "./components/inputs/reactHookForm/selectInputs/SelectInput.js";
89
+ import { EnumInput } from "./components/inputs/reactHookForm/selectInputs/EnumInput.js";
89
90
  import { TableNumericalInput } from "./components/inputs/reactHookForm/tableInputs/table-numerical-input.js";
90
91
  import { TableTextInput } from "./components/inputs/reactHookForm/tableInputs/table-text-input.js";
91
92
  import { DescriptionField } from "./components/inputs/reactHookForm/text/DescriptionField.js";
@@ -191,6 +192,13 @@ import { SubstationCreationForm } from "./components/network-modifications/subst
191
192
  import { substationCreationDtoToForm, substationCreationEmptyFormData, substationCreationFormSchema, substationCreationFormToDto } from "./components/network-modifications/substation/creation/substationCreation.utils.js";
192
193
  import { SubstationModificationForm } from "./components/network-modifications/substation/modification/SubstationModificationForm.js";
193
194
  import { substationModificationDtoToForm, substationModificationEmptyFormData, substationModificationFormSchema, substationModificationFormToDto } from "./components/network-modifications/substation/modification/substationModification.utils.js";
195
+ import { CreateSwitchesDialog } from "./components/network-modifications/voltage-level/creation/switches-between-sections/creation/CreateSwitchesDialog.js";
196
+ import { SwitchesBetweenSections } from "./components/network-modifications/voltage-level/creation/switches-between-sections/SwitchesBetweenSections.js";
197
+ import { CouplingOmnibusForm } from "./components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusForm.js";
198
+ import { CouplingOmnibusCreation } from "./components/network-modifications/voltage-level/creation/coupling-omnibus/CouplingOmnibusCreation.js";
199
+ import { VoltageLevelCreationForm } from "./components/network-modifications/voltage-level/creation/VoltageLevelCreationForm.js";
200
+ import { SWITCH_TYPE, buildNewBusbarSections, getCreateSwitchesEmptyFormData, getCreateSwitchesValidationSchema, translateSwitchKinds, voltageLevelCreationDtoToForm, voltageLevelCreationEmptyFormData, voltageLevelCreationFormSchema, voltageLevelCreationFormToDto } from "./components/network-modifications/voltage-level/creation/voltageLevelCreation.utils.js";
201
+ import { SwitchKind } from "./components/network-modifications/voltage-level/creation/voltageLevelCreation.types.js";
194
202
  import { useStateBoolean } from "./hooks/customStates/useStateBoolean.js";
195
203
  import { useStateNumber } from "./hooks/customStates/useStateNumber.js";
196
204
  import { useModificationLabelComputer } from "./hooks/useModificationLabelComputer.js";
@@ -220,7 +228,7 @@ import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin
220
228
  import { backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList, handleNotOkResponse, parseError, safeEncodeURIComponent } from "./services/utils.js";
221
229
  import { getVoltageInitParameters, getVoltageInitUrl } from "./services/voltage-init.js";
222
230
  import { fetchShortCircuitParameters, getShortCircuitSpecificParametersDescription, updateShortCircuitParameters } from "./services/short-circuit-analysis.js";
223
- import { fetchNetworkModification, updateModification } from "./services/networkModification.js";
231
+ import { fetchBusBarSectionsForNewCoupler, fetchNetworkModification, updateModification } from "./services/networkModification.js";
224
232
  import { fetchDynamicMarginCalculationParameters, fetchDynamicMarginCalculationProviders, updateDynamicMarginCalculationParameters } from "./services/dynamic-margin-calculation.js";
225
233
  import { equalsArray } from "./utils/algos.js";
226
234
  import { ActivePowerAdornment, AmpereAdornment, KiloAmpereAdornment, KilometerAdornment, MVAPowerAdornment, MicroSusceptanceAdornment, OhmAdornment, PercentageAdornment, ReactivePowerAdornment, SusceptanceAdornment, VoltageAdornment } from "./utils/constants/adornments.js";
@@ -380,7 +388,10 @@ export {
380
388
  CountriesInput,
381
389
  CountrySelectionInput,
382
390
  CountryValueEditor,
391
+ CouplingOmnibusCreation,
392
+ CouplingOmnibusForm,
383
393
  CreateParameterDialog,
394
+ CreateSwitchesDialog,
384
395
  CsvExport,
385
396
  CsvUploader,
386
397
  CustomAGGrid,
@@ -438,6 +449,7 @@ export {
438
449
  ElementSearchInput,
439
450
  ElementType,
440
451
  ElementValueEditor,
452
+ EnumInput,
441
453
  EquipmentItem,
442
454
  EquipmentType,
443
455
  EquipmentsSelectionType,
@@ -683,6 +695,7 @@ export {
683
695
  SUBSTATION_LAYOUT,
684
696
  SVAR_REGULATION_MODE_OPTIONS,
685
697
  SVC,
698
+ SWITCH_TYPE,
686
699
  SecurityAnalysisParametersDialog,
687
700
  SecurityAnalysisParametersInline,
688
701
  SelectClearable,
@@ -713,7 +726,9 @@ export {
713
726
  SubstationModificationForm,
714
727
  SusceptanceAdornment,
715
728
  SwitchInput,
729
+ SwitchKind,
716
730
  SwitchWithLabel,
731
+ SwitchesBetweenSections,
717
732
  TAB_INFO,
718
733
  TRANSFORMERS_SELECTION_TYPE,
719
734
  TWT_SPLIT_SHUNT_ADMITTANCE,
@@ -758,6 +773,7 @@ export {
758
773
  VoltageInitParametersInLine,
759
774
  VoltageInitTabValues,
760
775
  VoltageLevel,
776
+ VoltageLevelCreationForm,
761
777
  WRITE_SLACK_BUS,
762
778
  YUP_REQUIRED,
763
779
  alertThresholdMarks,
@@ -767,6 +783,7 @@ export {
767
783
  backendFetchFile,
768
784
  backendFetchJson,
769
785
  backendFetchText,
786
+ buildNewBusbarSections,
770
787
  businessErrorsEn,
771
788
  businessErrorsFr,
772
789
  cardErrorBoundaryEn,
@@ -822,6 +839,7 @@ export {
822
839
  extractErrorMessageDescriptor,
823
840
  fetchAppsMetadata,
824
841
  fetchBaseVoltages,
842
+ fetchBusBarSectionsForNewCoupler,
825
843
  fetchConfigParameter,
826
844
  fetchConfigParameters,
827
845
  fetchCsvSeparator,
@@ -859,6 +877,8 @@ export {
859
877
  getComputedLanguage,
860
878
  getConcatenatedProperties,
861
879
  getContingencyListsInfosFormSchema,
880
+ getCreateSwitchesEmptyFormData,
881
+ getCreateSwitchesValidationSchema,
862
882
  getEquipmentTypeShortLabel,
863
883
  getEquipmentsInfosForSearchBar,
864
884
  getExpertFilterEmptyFormData,
@@ -987,6 +1007,7 @@ export {
987
1007
  toNumber,
988
1008
  topBarEn,
989
1009
  topBarFr,
1010
+ translateSwitchKinds,
990
1011
  treeviewFinderEn,
991
1012
  treeviewFinderFr,
992
1013
  unitToKiloUnit,
@@ -1025,5 +1046,9 @@ export {
1025
1046
  useUniqueNameValidationFr,
1026
1047
  useValid,
1027
1048
  validateValueIsANumber,
1049
+ voltageLevelCreationDtoToForm,
1050
+ voltageLevelCreationEmptyFormData,
1051
+ voltageLevelCreationFormSchema,
1052
+ voltageLevelCreationFormToDto,
1028
1053
  yup as yupConfig
1029
1054
  };
@@ -11,7 +11,7 @@ import { fetchCurrentAnnouncement, fetchUserDetails } from "./userAdmin.js";
11
11
  import { backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList, handleNotOkResponse, parseError, safeEncodeURIComponent } from "./utils.js";
12
12
  import { getVoltageInitParameters, getVoltageInitUrl } from "./voltage-init.js";
13
13
  import { fetchShortCircuitParameters, getShortCircuitSpecificParametersDescription, updateShortCircuitParameters } from "./short-circuit-analysis.js";
14
- import { fetchNetworkModification, updateModification } from "./networkModification.js";
14
+ import { fetchBusBarSectionsForNewCoupler, fetchNetworkModification, updateModification } from "./networkModification.js";
15
15
  import { fetchDynamicMarginCalculationParameters, fetchDynamicMarginCalculationProviders, updateDynamicMarginCalculationParameters } from "./dynamic-margin-calculation.js";
16
16
  export {
17
17
  PREFIX_STUDY_QUERIES,
@@ -26,6 +26,7 @@ export {
26
26
  exportFilter,
27
27
  fetchAppsMetadata,
28
28
  fetchBaseVoltages,
29
+ fetchBusBarSectionsForNewCoupler,
29
30
  fetchConfigParameter,
30
31
  fetchConfigParameters,
31
32
  fetchCurrentAnnouncement,
@@ -1,5 +1,6 @@
1
1
  import { UUID } from 'node:crypto';
2
2
  export declare function fetchNetworkModification(modificationUuid: UUID): Promise<Response>;
3
+ export declare function fetchBusBarSectionsForNewCoupler(voltageLevelId: string, busBarCount: number, sectionCount: number, switchKindList: string[]): Promise<string[]>;
3
4
  export declare function updateModification({ modificationUuid, body }: {
4
5
  modificationUuid: UUID;
5
6
  body: string;
@@ -1,4 +1,4 @@
1
- import { safeEncodeURIComponent, backendFetch, backendFetchText } from "./utils.js";
1
+ import { safeEncodeURIComponent, backendFetch, backendFetchJson, backendFetchText } from "./utils.js";
2
2
  const PREFIX_NETWORK_MODIFICATION_QUERIES = `${"api/gateway"}/network-modification`;
3
3
  function getUrl() {
4
4
  return `${PREFIX_NETWORK_MODIFICATION_QUERIES}/v1/network-modifications`;
@@ -8,6 +8,19 @@ function fetchNetworkModification(modificationUuid) {
8
8
  console.debug(modificationFetchUrl);
9
9
  return backendFetch(modificationFetchUrl);
10
10
  }
11
+ function fetchBusBarSectionsForNewCoupler(voltageLevelId, busBarCount, sectionCount, switchKindList) {
12
+ console.info("Fetching bus bar sections ids for voltage level : ", voltageLevelId);
13
+ const urlSearchParams = new URLSearchParams();
14
+ urlSearchParams.append("voltageLevelId", voltageLevelId);
15
+ urlSearchParams.append("busBarCount", String(busBarCount));
16
+ urlSearchParams.append("sectionCount", String(sectionCount));
17
+ switchKindList.forEach((kind) => {
18
+ urlSearchParams.append("switchKindList", kind);
19
+ });
20
+ const url = `${PREFIX_NETWORK_MODIFICATION_QUERIES}/v1/network-modifications/busbar-sections-for-new-coupler?${urlSearchParams.toString()}`;
21
+ console.debug(url);
22
+ return backendFetchJson(url);
23
+ }
11
24
  function updateModification({ modificationUuid, body }) {
12
25
  const url = `${getUrl()}/${safeEncodeURIComponent(modificationUuid)}`;
13
26
  console.info("Updating modification", { url });
@@ -21,6 +34,7 @@ function updateModification({ modificationUuid, body }) {
21
34
  });
22
35
  }
23
36
  export {
37
+ fetchBusBarSectionsForNewCoupler,
24
38
  fetchNetworkModification,
25
39
  updateModification
26
40
  };
@@ -76,6 +76,41 @@ export declare const networkModificationsEn: {
76
76
  PropertyValue: string;
77
77
  Name: string;
78
78
  Country: string;
79
+ CreateVoltageLevel: string;
80
+ VoltageLevelCreationError: string;
81
+ SUBSTATION: string;
82
+ VoltageText: string;
83
+ NominalVoltage: string;
84
+ LowVoltageLimit: string;
85
+ HighVoltageLimit: string;
86
+ ShortCircuit: string;
87
+ LowShortCircuitCurrentLimit: string;
88
+ HighShortCircuitCurrentLimit: string;
89
+ BusBarSections: string;
90
+ BusBarCount: string;
91
+ numberOfSections: string;
92
+ SwitchesBetweenSections: string;
93
+ Coupling_Omnibus: string;
94
+ AddCoupling_Omnibus: string;
95
+ SwitchBetweenSectionsLabel: string;
96
+ BusBarSectionID1: string;
97
+ BusBarSectionID2: string;
98
+ SubstationId: string;
99
+ substationName: string;
100
+ DeleteRows: string;
101
+ validate: string;
102
+ Breaker: string;
103
+ BREAKER: string;
104
+ DISCONNECTOR: string;
105
+ Disconnector: string;
106
+ BusBarCountMustBeGreaterThanOrEqualToOne: string;
107
+ SectionCountMustBeGreaterThanOrEqualToOne: string;
108
+ mustBeGreaterOrEqualToZero: string;
109
+ CreateCouplingDeviceIdenticalBusBar: string;
110
+ CreateSubstationInVoltageLevelIdenticalId: string;
111
+ voltageLevelNominalVoltageMaxValueError: string;
112
+ ShortCircuitCurrentLimitMustBeGreaterOrEqualToZero: string;
113
+ ShortCircuitCurrentLimitMinMaxError: string;
79
114
  DuplicatedPropsError: string;
80
115
  YupRequired: string;
81
116
  };